Coder Social home page Coder Social logo

Rename target folder about sevenzipsharp HOT 8 CLOSED

squid-box avatar squid-box commented on August 15, 2024
Rename target folder

from sevenzipsharp.

Comments (8)

IrinaRazel avatar IrinaRazel commented on August 15, 2024 1

ok, I just will delete this dll from my project. No need any projects with shit support.

from sevenzipsharp.

squid-box avatar squid-box commented on August 15, 2024

If you just want to ignore the directory structure in the archive, you can set the Extractor property PreserveDirectoryStructure to false and it will extract all files in the archive to the same directory. Just be careful that you don't have several files with the same name in the archive.

using (var extractor = new SevenZipExtractor("someArchive.7z"))
{
    extractor.PreserveDirectoryStructure = false;
    extractor.ExtractArchive("my folder");
}

from sevenzipsharp.

IrinaRazel avatar IrinaRazel commented on August 15, 2024

no no, I need PreserveDirectoryStructure=true but extract it replacing root directory.
root/folder1/file.txt => my folder/folder1/file.txt I need too

from sevenzipsharp.

squid-box avatar squid-box commented on August 15, 2024

I'm not aware of any such feature, but you could likely achieve this by handling each extracted file and rename/move it after extraction.

Either by unpacking to a temporary directory and moving the files, or look into using the Extractor events FileExtractionStarted or FileExtractionFinished.

Or even use Compressor.ModifyArchive to rename the files within the archive before extraction, but I'm not sure of the performance impacts of that.

from sevenzipsharp.

IrinaRazel avatar IrinaRazel commented on August 15, 2024

FileExtractionStarted or FileExtractionFinished not available to modify FileName property, it is readonly

from sevenzipsharp.

squid-box avatar squid-box commented on August 15, 2024

Then you'll have to rename them manually after extraction.

from sevenzipsharp.

IrinaRazel avatar IrinaRazel commented on August 15, 2024

Can you include this feauture in library?

from sevenzipsharp.

squid-box avatar squid-box commented on August 15, 2024

I don't see why I would, it seems to be a very niche request to rewrite part of the path of a structured archive.

Feel free to propose a pull request with the added functionality, but I won't spend time implementing this for you.

from sevenzipsharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.