in reply to Re^4: 7zip a folder
in thread 7zip a folder

You'd have to implement this yourself. It seems to me the creators of 7-zip aren't willing to implement this because it is too easy to destroy a freshly created archive after all the files are compressed and deleted.

Replies are listed 'Best First'.
Re^6: 7zip a folder
by ytjPerl (Scribe) on Nov 06, 2017 at 19:19 UTC
    Basically, what I am doing now is to move all the files falling into my date range to a new folder which foldername is the timestamp of those files, then zip all the file under this folder, I could not get it through, because it is saying \$foldername\ the system cannot find the path specified.
    $date = strftime("%Y-%m-%d", localtime); mkdir my $foldername = "D:/log_script/Archive/$date"; my @cmd = 'D:/app/7-Zip/7z.exe', 'a', '-mx9', 'D:/log_script/Archive/target.zip', '$foldername/*.log' ); print 'about to execute: ', Dumper \@cmd; system @cmd;

      Have you printed @cmd before running it through system?

      If you have done so, you will see that single quotes do not interpolate variables. $forldername appears verbatim in your command.

      Most likely, you want to use double quotes instead:

      "$foldername/*.log",
Re^6: 7zip a folder
by ytjPerl (Scribe) on Nov 06, 2017 at 18:35 UTC
    Hi Soonix, Can I also ask you what is the 9 meaning in -mx9? Thanks