Exclude File or Folder When archiving

Aug 4, 2013 at 4:31 PM
Hello

Is there any way to exclude files (or folders) from archive generation?
for example : archive all files except text files (*.txt)?

For example the following will create a backup of the C:\Project\To\Backup directory excluding any folders that satisfy ?svn

"C:\Program Files\7-Zip\7z.exe" a -r -tzip -y -xr!?svn* Project.zip C:\Project\To\Backup*

Thank you for your help
Aug 5, 2013 at 8:50 AM
Edited Aug 5, 2013 at 8:50 AM
Hello.

have you tried using the FileInfo class? pass all the files that you want to compress through a simple if statement before compressing to check the extension or attributes of the file. Then compress only those files that are passed through the condition.

Hope this solves your problem. Feel free to ask any doubts.

Regards,
Tarak
Aug 5, 2013 at 9:46 AM
Hello

Thank you for your response

I think i can do this. But, for me, it will be better if the sevenzipSharp wrapper manages this filter (this option is exposed by 7zip so it can be managed directly by SevenZipSharp)

I looked at the SevenZipCompression method and it uses Directory.GetFiles(SearchPattern), so if i do this also in my side, it is not good for performance

I think here, we need new method interface that allows us to do this directly.

Youcef