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


Tags
rsync

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
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

Code:
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

Code:
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?

Thanks!

Last edited by Scott; 01-30-2011 at 12:18 PM.. Reason: Please use code tags
Sponsored Links
    #2  
Old 01-31-2011
DGPickett DGPickett is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 19 August 2014, 4:23 PM EDT
Location: Southern NJ, USA (Nord)
Posts: 4,396
Thanks: 8
Thanked 535 Times in 514 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):

Code:
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 11:03 AM
rsync multiple remote directories one connection sardare Shell Programming and Scripting 0 03-11-2010 12:44 AM
Renaming files after their directory name in multiple sub directories robotsbite UNIX for Dummies Questions & Answers 2 07-16-2009 12:54 PM
single quote problem with rsync mr_boysito Shell Programming and Scripting 9 12-05-2008 08:49 PM
Copy single file to multiple directories kthatch UNIX for Dummies Questions & Answers 2 11-11-2007 05:10 PM



All times are GMT -4. The time now is 12:50 AM.