Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET Zip/unzip all but one type of files

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19533 |

    I’d like to zip a directory containining all sorts of different file types, but I’d like to exclude one type of files. E.g. the directory contains .ico .htm and .txt but I’d only like to zip/unzip .htm and .txt. How can I do this?

    I know that I easily can set the filter in CopyFilesTo() to .htm and .txt, but the actual directory contains MANY different sort of files and there is only ONE type that is never to be zipped/unzipped. For this reason I’d like to specify the one file type instead of all the others…

    Hope somebody can be of assistance.

    Imported from legacy forums. Posted by candersen (had 2752 views)

    User (Old forums)
    Member
    Post count: 23064

    Glad you ask, because the filtering is mighty powerful. In your case, it’s as simple as this:

    source.CopyFilesTo( dest, true, true, new NotFilter( “*.ico” ) );

    Now, I know what will be the subject of my first 2006 blog post: FileSystem filtering!

    Imported from legacy forums. Posted by Martin (had 339 views)

    User (Old forums)
    Member
    Post count: 23064

    Thank you. That’s really simple! I couldn’t understand why you hadn’t implemented something like that, but that’s really a good solution.

    Imported from legacy forums. Posted by candersen (had 3507 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.