-   Linux - Newbie (
-   -   Help with rsync command (

rjo98 10-19-2011 02:18 PM

Help with rsync command
I usually don't do this right, so posting here for some help before I try it. What I want to do is rsync all files from a folder that start with wedding (not case sensitive as it could be wedding, Wedding, WEDDING, etc) and put them into a folder on another server with the same file name. For the example, all the jpg's are in /data/pics on the box i'm running this from, and i want to put them into /data/photos/weddings/2011 on I think the command should look something like this, but i'm not sure how to do the case insensitive stuff or if i'm doing anything else wrong. rsync and file masks aren't my thing yet :(

rsync -r -a -z -p -v -e ssh /data/pics/wedding*.jpg username@

itnomad 10-19-2011 06:06 PM

Look at the includes-from option in the man page. Put your patterns in a file. One pattern per line. For instance wedding* on one line Wedding* on the next. etc. Quoting the patterns is not necessary. I tested transferring a local file to a local file with this command.
rsync -avz --include-from='include_patterns' --exclude='*' /home/jack/Desktop/ /home/jack/rsyntest

Surely it would work the same doing a local to remote transfer. You might also want to look into the -a option. This archive option, preserves permissions, timestamps, owner and group, symbolic links, and is recursive.

spankbot 10-19-2011 06:37 PM

I would add that "-e ssh" is deprecated and not needed in a modern implementation. Typically rsync is configured to use ssh by refault.

Also, you really should lock down a file naming convention as that will save you much trouble and headache in the long run. But I understand that is not always possible.

rjo98 10-20-2011 02:44 AM

Thanks for the responses. they are all Windows users, so Wedding = wedding = wEdding to them, so they dont listen haha.

All times are GMT -5. The time now is 02:08 AM.