Tar exclude folders
To exclude a file when backing up with tar, you can use option --exclude
If you want a list of files excluded when taking backup, use the option
-X, --exclude-from FILE exclude files listed in FILE
With the help of -X option, you can exclude a folder and all files inside. To do this, you need to create a list of files in the folder with find command.
I want to take backup of folder
But i do not want to include files inside 2 sub folders.
This can be done with following commands
find /home/USERNAME/public_html/flvideo/ -iname '*' > my-excludes find /home/USERNAME/public_html/video/ -iname '*' >> my-excludes tar cvf 1.tar /home/USERNAME/public_html -X my-excludes