Home Forums .NET libraries Xceed Zip & Real-Time Zip for .NET ignore folder names

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

    is there a way of ignoring folder paths when unzipping both zip and tar files? I am using
    archive.CopyTo(“C:\download”,true,true) and don’t want any subfolders to be created.

    Imported from legacy forums. Posted by sallen (had 2014 views)

    User (Old forums)
    Member
    Post count: 23064

    Make a ZippedFile of every file in the archive, and then copy them to the exact location you want.

    e.g. :

    AbstractFolder destination = new DiskFolder( @”D:\OneLocation\” );
    AbstractFile zipFile = new DiskFile( @”D:\archive.zip” );
    ZipArchive archive = new ZipArchive( zipFile );

    foreach( ZippedFile file in archive.GetFiles( true ) )
    {
    file.CopyTo( destination, true );
    }

    Imported from legacy forums. Posted by André (had 2997 views)

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