I need to get the info on the file for when it was last modified using a perl script heres the relevant code:
#where $file equals "MyFile.txt"
$backslash = "\\";
$upTwoLayersHelper = "..$backslash..$backslash";
@fileInfo = qx(forfiles /M $file /P $upTwoLayersHelper /C "cmd /c echo @fdate @ftime");
qx is a function in perl that allows the execution of a system command and redirects the output to a variable
Ive already looked into using stat
and it kept returning
Dec 31 of like 1960
so this did not work for me :/
I used the variables $backslash
and $upTwoLayersHelper
to build 'safely' the path since windows likes to use \ rather than / and I tested to make sure that the variables interpolate within the qx(...here...) function call.
My problem is the only output I get is
ECHO is on.
when I print the @fileInfo
variable
BUT when I run the same command within the qx(...) function call outside of perl, and just in batch from the command line as a command it works and returns the correct date information
what am I doing wrong in my perl script?
Thanks for your time!