1

I am trying to copy files from a server to my local directory using rsync.But after some times local files are being moved to archive.So, next time when I will copy the contents from the remote directory,I don't want to copy the files which are copied earlier.

I am using the below mentioned command

rsync -avhe ssh --progress [email protected]:$RemoteFolderPath1 -t $LocalFolderPath1
1
  • I think you are looking for the update option (-u), quoting man page: -u, --update skip files that are newer on the receiver
    – herbert
    Sep 19, 2015 at 7:53

2 Answers 2

1

When you archive a file, append its name to a file, which I'll call archived_files.txt. Then use --exclude-from=archived_files.txt in your rsync command to skip those files.

1
  • Thanks a lot Barmar for your valuable input . Your input will help me to implement the required logic .
    – user134867
    Sep 20, 2015 at 6:35
0

in rsync man :

you can use:

--update                to update the existing files
--ignore-existing       skip updating files that exist on destination 

the

--progress 

that you used is for showing what's going on.

1
  • Thanks for your input . Actually as I have mentioned earlier my local files after 5 mins will be moved to archive directory.But in the server it will exist for 3 days .Example : In sever location( RemoteFolderPath1 ) contains A,B files at 11 am.So,once I have copied A, B using rsync in LocalFolderPath1 and after 5 mins those files will be moved to archive.So,after 5 mins at 11.05am in the sever A, B will be there and C,D files will also be created.But this time I want to copy C,D only to the local folder not the earlier files(A, B). How can I achieve this functionality?
    – user134867
    Sep 19, 2015 at 14:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .