Reputation: 1
The problem is rather simple. I am making a module that creates a zip and then adds files to the zip using this command in Delphi 6:
ExecuteAndWait('7z.exe', Format('u -p%s "%s" "%s" -spf2 -xr!EDZ', [ZipPassword, ZipFileName, filePathToAdd]), SW_HIDE, ExitCode)
Basically calling invisible cmd.exe
to use 7zip functionality.
Example:
\\192.168.1.243\EDZ\25_0001\File.txt
The result should be only 25_0001\File.txt
but I always seem to get EDZ\25_0001\File.txt
.
While running the command from the directory, it works well, but I can't change it for each file. Also, I need to do some checks on the files so I can't just zip the whole folder.
While I want to keep most of the folder structure, I can't seem to get the x x! xr xr!
to work while specifying full paths or relative ones.
I have tried most of the 7zip commandline parameters but I am not achieving the desired results. I have tried -w
to set the working directory. I have tried -j
to remove the directory.
Upvotes: 0
Views: 186
Reputation: 8386
You are using -spf2 command switch which stores files with full paths without drive letter.
If you want to store files with relative path you should omit this command switch. Just make sure you switch the work directory to the said folder before calling ExecuteAndWait
.
Upvotes: 2