Unix/Linux Go Back    


UNIX for Beginners Questions & Answers If you're not sure where to post a Unix or Linux question, post it here. All unix and Linux beginners welcome in this forum!

Move directory with rsync and delete from source

UNIX for Beginners Questions & Answers


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 05-19-2017
Siddheshk Siddheshk is offline
Registered User
 
Join Date: Jun 2009
Last Activity: 23 May 2017, 9:44 AM EDT
Posts: 123
Thanks: 0
Thanked 0 Times in 0 Posts
Move directory with rsync and delete from source

I need a rsync command which will exclude certain files and directories from source and copy the rest. I got this command working,


Code:
sudo rsync -avzh --exclude 'bin' --exclude 'braintree' --exclude 'colinmollenhour' --exclude 'composer' --exclude 'doctrine' --exclude 'fabpot' --exclude 'justinrainbow' --exclude 'league' --exclude 'lusitanian' --exclude 'magento' --exclude 'monolog' --exclude 'oyejorge' --exclude 'pdepend'  --exclude 'pelago' --exclude 'phpmd' --exclude 'phpseclib' --exclude 'phpunit' --exclude 'psr' --exclude 'sebastian' --exclude 'seld'  --exclude 'sjparkinson'  --exclude 'squizlabs'  --exclude 'symfony'  --exclude 'tedivm'  --exclude 'theseer' --exclude 'tubalmartin' --exclude 'zendframework' --exclude 'autoload.php' /var/www/html/magento2/vendor/ /var/www/html/magento2/app/code/

Now this works fine. It does copy everything other than excluded directories but i want this to delete the copied files from source location too. Please advise.

Regards,
Siddhesh
Sponsored Links
    #2  
Old Unix and Linux 05-19-2017
RudiC RudiC is online now Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 19 August 2017, 6:59 AM EDT
Location: Aachen, Germany
Posts: 11,175
Thanks: 287
Thanked 3,444 Times in 3,173 Posts
Does your rsync version offer the
Quote:
--remove-source-files sender removes synchronized files (non-dir)
option? If not, log to a file, and create a removal script from the log.
Sponsored Links
    #3  
Old Unix and Linux 05-20-2017
Siddheshk Siddheshk is offline
Registered User
 
Join Date: Jun 2009
Last Activity: 23 May 2017, 9:44 AM EDT
Posts: 123
Thanks: 0
Thanked 0 Times in 0 Posts
HI,

--remove-source-files is only applicable for files. I need to remove directories too.

-S
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to move gz files from one source directory to destination directory? venkat918 UNIX for Dummies Questions & Answers 11 04-06-2016 04:29 AM
Move all files from source to destination directory based on the filename chetancrsp18 Shell Programming and Scripting 1 07-20-2011 03:23 AM
Why rsync deletes source directory? travegre UNIX for Advanced & Expert Users 1 01-04-2010 06:56 AM
Rsync help - unable to delete the Source file amitkhiare Shell Programming and Scripting 1 07-23-2009 03:56 AM
Bash rsync but move not delete Movomito Shell Programming and Scripting 1 04-30-2008 04:37 PM



All times are GMT -4. The time now is 07:05 AM.