rsync multiple directories into single directory on remote | Unix Linux Forums | Shell Programming and Scripting

  Go Back    

Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

rsync multiple directories into single directory on remote

Shell Programming and Scripting


Closed Thread    
Thread Tools Search this Thread Display Modes
Old 01-30-2011
wreckedred wreckedred is offline
Registered User
Join Date: Jan 2011
Last Activity: 3 August 2012, 3:59 PM EDT
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
rsync multiple directories into single directory on remote

I would like to find and backup all *.mp4 files from /Pictures and its sub-directories and move them to a single directory on a remote. I can find and move the files but I don't want the directory structure...just the files to be placed in a single remote directory.

To find my files I use

rsync -r -a -v -e "ssh -l user" --delete --include '*/' --include  '*.mp4' --exclude '*' /home/drew/Pictures/ remoteserver:/Users/drew/mp4

but this creates all the subdirectories

I also tried

find ~/Pictures -name "*.mp4" -exec rsync -r -a -v -e "ssh -l user" --delete {} remote:/Users/drew/mp4 \;

This works but takes forever

Any suggestions?


Last edited by Scott; 01-30-2011 at 01:18 PM.. Reason: Please use code tags
Sponsored Links
Old 01-31-2011
DGPickett DGPickett is offline Forum Advisor  
Registered User
Join Date: Oct 2010
Last Activity: 28 January 2015, 5:24 PM EST
Location: Southern NJ, USA (Nord)
Posts: 4,624
Thanks: 8
Thanked 573 Times in 547 Posts
Since rsync wants to make matching directories, it might be good to give it multiple directories (a mirror), but then hard link the files to another single directory on the same device. A cron script could remove files no longer having 2 links and link new files (having only 1):

rm $( find common_dir -type f -links 1 )
ln $( find ... -type f -links 1 ) common_dir

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
rsync a single file timgolding Shell Programming and Scripting 2 10-19-2010 12:03 PM
rsync multiple remote directories one connection sardare Shell Programming and Scripting 0 03-11-2010 01:44 AM
Renaming files after their directory name in multiple sub directories robotsbite UNIX for Dummies Questions & Answers 2 07-16-2009 01:54 PM
single quote problem with rsync mr_boysito Shell Programming and Scripting 9 12-05-2008 09:49 PM
Copy single file to multiple directories kthatch UNIX for Dummies Questions & Answers 2 11-11-2007 06:10 PM

All times are GMT -4. The time now is 12:36 PM.