I want to know How old are my files which are present in the directory. If it is older than seven days I want to delete it from the directory. For that I tried this.
#!/usr/bin/perl -- use strict; use warnings; my $command = ; my @files = `ls` ; my $old=0; foreach my $file (@files) { chomp $file; print $command; $old = `expr $(date +%s) - $(date +%s -r $file)`; print "$file","::",$old,"\n"; }
But in these the "$" sign in the command mismatches. I used escape(\) before that. Even its not working. How to do this
In reply to How to Know how much old my file is by ravi45722
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |