viernes, 12 de agosto de 2016

Using rsync to copy a movie and start watching inmediately

Sometimes I want to watch a movie that is on my home server. With standard copy you have to wait for the whole file to be transferred.

The following bash script does it:

#!/bin/bash
rsync -aP --inplace user@x.y.z:/home/mydir/"${1// /\\ \\}" .


Usage
myscript 'filename perhaps with spaces in it'

Explanations
--inplace makes the file inmediately accessible for playing.
The strange items instead of $1 escape spaces in the filename.
Do not forget the trailing dot '.'

No hay comentarios:

Publicar un comentario