This project is read-only.

Exclude File or Folder When archiving

Aug 4, 2013 at 5:31 PM

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* C:\Project\To\Backup*

Thank you for your help
Aug 5, 2013 at 9:50 AM
Edited Aug 5, 2013 at 9:50 AM

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.

Aug 5, 2013 at 10:46 AM

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.