0

This is my code to exclude some files,when copy files from one folder to another folder,Copy folder recursively, excluding some folders , I got the idea from this link.

But now the problem is,if I need to exclude only one file,this is working,but for many it's not.(I include all the files,that need to exclude in a text file and give the name of that text file like this,exclude=textfile.txt ,but still it's not working)

cd /source_directory
tar cf - --exclude=dir_to_exclude . | (cd /destination && tar xvf - )
Community
  • 1
  • 1
acer
  • 303
  • 1
  • 5
  • 11

1 Answers1

0

I found out the solution,here when I use exclude-from,then I can able to exclude so many files or folders.

cd /source_directory
tar cf - --exclude-from=dir_to_exclude . | (cd /destination && tar xvf - )
acer
  • 303
  • 1
  • 5
  • 11