0

On my GNU/Linux machine I want to backup a list of files specified in a text file names rsyncFolders.txt the idea is to keep the files I want and to exclude unwanted ones to backup.

In these folders there are some that contain javascript and PHP code used to develop applications. In them there exist folders such as node_modules and vendor containing 3rd party libraries that are not needed in backup, also mentioned in .gitignore files.

Therefore I want to:

  • If in my destination folder these files exist delete them.
  • If does not exist skip them completely.

Do you know how to do that?

0

Use

--exclude=PATTERN

And

--delete-excluded

https://linux.die.net/man/1/rsync

  • So how I can scan the destination and clean up any .gitignored or vendor or a nnode_modules folders? – Dimitrios Desyllas Apr 15 at 15:19
  • @DimitriosDesyllas as long as they are in your exclude PATTERN, then just add --delete-excluded – BowlOfRed Apr 19 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.