ravi45722 has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to Know how much old my file is
by Corion (Patriarch) on Sep 15, 2015 at 07:16 UTC | |
by ravi45722 (Pilgrim) on Sep 15, 2015 at 08:28 UTC | |
|
Re: How to Know how much old my file is
by Discipulus (Canon) on Sep 15, 2015 at 07:01 UTC | |
by Anonymous Monk on Sep 15, 2015 at 07:20 UTC | |
by Discipulus (Canon) on Sep 15, 2015 at 07:53 UTC | |
|
Re: How to Know how much old my file is
by Laurent_R (Canon) on Sep 15, 2015 at 07:34 UTC | |
|
Re: How to Know how much old my file is
by Anonymous Monk on Sep 15, 2015 at 07:24 UTC | |
|
Re: How to Know how much old my file is
by pme (Monsignor) on Sep 15, 2015 at 07:01 UTC | |
|
Re: How to Know how much old my file is
by Anonymous Monk on Sep 15, 2015 at 12:29 UTC | |
by ravi45722 (Pilgrim) on Sep 16, 2015 at 06:06 UTC |