[Wiltshire] rsync very selectively

Samuel Ross samuel.ross at sirnet.co.uk
Mon Jun 11 20:51:24 UTC 2012


Hi Dave,

I too am not quite sure what you're trying to achieve. I may be too 
tired to read your email properly! Is it all .bash files under the 
scripts folder?

This achieves what I *Think* you're trying to do, try it and see (you 
can add the n flag (-avzn) to make it dry run only so it doesn't copy 
files, just tell you what it wants to copy):
rsync -avz --include '*/' --include '.bash*' --exclude '*' 
/home/jf/scripts/ jf at server:/home/jf/DesktopHomeBackup/


To be fair it was this command I ran to test it on my local machine:
rsync -avz --include '*/' --include '*.jpg' --exclude '*' 
/home/sam/Music/ /tmp/temp/

So the directory structure is maintained, but only .jpg files are copied.



Thanks,
Sam


On 11/06/12 21:32, Ralph Corderoy wrote:
> Hi Dave,
>
>> I can get the include file to copy .bash* but no matter what I try I
>> can't persuade it to recursively do directories, in this case the
>> scripts directory for starters. I've tried it with -r, --recursive,
>> --dirs, with a training /, without a trailing /, trailing /* ......
>> nothing works for me and I can't find a how-to.
> Can we clarify what you're trying to do.
>
>> rsync -av --recursive --include-from=/home/jf/scripts/BackupIncludes
>>      --delete-excluded --exclude='*' --bwlimit=3000 /home/jf/
>>      jf at server:/home/jf/DesktopHomeBackup
>>
>> and the BackupIncludes file contains
>> scripts/
>> .bash*
>      shopt -s nullglob&&
>      cd /home/jf&&
>      rsync -av scripts .bash* jf at server:/home/jf/DesktopHomeBackup
>
> The scripts you mean is /home/jf/scripts and no other, and the .bash*
> files are also in that directory if they exist?  That should mirror then
> to DesktopHomeBackup/{scripts,.bash*} on the remote machine.
>
> Cheers, Ralph.
>
> _______________________________________________
> Wiltshire mailing list
> Wiltshire at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/wiltshire




More information about the Wiltshire mailing list