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;
| [reply] [d/l] |
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",
| [reply] [d/l] [select] |
Hi Soonix,
Can I also ask you what is the 9 meaning in -mx9?
Thanks | [reply] |