I'm trying to write a utility that will go through a file that would look like this:
# Directory | file name | action | # of days without modification to the file for the command to take action
/work/test/|a*|delete|1
/work/test/|b*|compress|0
/work/test/|c*|compress|1
My script will go through the file deciding if, for example, there are files under /work/test/ that start with 'a' that haven't been modified in the last 1 days, and if so, it would delete them.
For this, I use the find command. Example:
my $command = "find " . $values[0] . $values[1] . " -mtime +" . $values[3] . " -delete ;\n";
system ($command);
But, I've been asked to retrieve the return code for each step to verify that the every step worked fine.
Now, I know that system() returns the return code, and the backticks return the output. But, how can I get both?