rsync to copy specific files
Hi friends!
I'm trying to copy all my jpg files to another folder. I'm using the following instruction: rsync -r -n -t -v --progress --ignore-existing --include=*.jpg --exclude * /Users/me/Documents/ /Users/me/Desktop/ The problem is that it is copying the pictures in the "root" folder, it does not search and copy the recursive folders. There are several directories below the original folder. -r is supposed to make the search recursive, but I can't find what is missing. Thanks in advance! |
It looks like your exclude expression is excluding everything which includes directories. So there's no tree to go through.
Try explicitly including directories with; rsync -r -n -t -v --progress --ignore-existing --include=*.jpg --include=*/ --exclude=* /Users/me/Documents/ /Users/me/Desktop/ |
I think that scp would be better for this purpose.
Entering a directory and issuing scp *.jpg [user]@[target address]:[target path] would copy all the *.jpg files from the source directory to the target directory. You can also scp -r a directory. More about scp: http://linux.about.com/od/commands/l/blcmdl1_scp.htm |
You can add the -a option and it will copy recursively.
|
Thanks to all. I'll try them today and post the results.
Have a great day. |
rsync some file types
Hello Friends
Here is the situation (of course I've google it) I have several backups of my files in many external HD. I just want to recover some kind of files: (pictures, music, spreadsheets etc). I want to put all of these files in a single directory. I'm trying to use rsync but I'd like rsync to: -Copy just some kind of files (jpg, mp3, etc) -Put them all in a single directory. One option is running the script in a per file type basis, so I put all the mp3 in one folder, all the jpg in others - Make backups of files with the same name. For example if 3 files are named x.doc, then save each with a different name x1.doc, x2.doc and so on. (is this possible?) - If it is possible, I'd like to move the files in stead of copying them. Thanks a lot for your help! |
Why not just 'find /some/path -type f -iname \*.ogg -print0 | xargs -0 -iX mv 'X' /some/other/path;'?
|
Thanks unspawn!
I've tried. The problem is that it automatically replaces same name files. As many files have the same name, is there any argument to make backups? |
Depends on your version of mv. The info here is for a version that does support backup with -b or --backup[=CONTROL]
|
One last question, how is backup[=CONTROL] used?
Can't find it in the manual. backup[=CONTROL] serialises the backups? Thanks! |
The info at the bottom of that page is for the version control:
Code:
The backup suffix is '~', unless set with --suffix or SIM- |
All times are GMT -5. The time now is 08:26 PM. |