Jocqui has asked for the wisdom of the Perl Monks concerning the following question:
I have a list of files in teh following format and i wish to delete all files that are older than the latest .bac file not including the file with the same name as the .bac file or any other .bac files. A sample of teh files are bellow. I wish to dleet everything apart from 000000010000000300000067.00000020.bac ,000000010000000300000067 and files created after 000000010000000300000067.00000020.bac .Any ideas how to do this in perl
rw------- 1 postgres postgres 16777216 Jul 16 22:56 00000001000000030 +000005B -rw------- 1 postgres postgres 16777216 Jul 16 22:59 0000000100000003 +0000005C -rw------- 1 postgres postgres 16777216 Jul 16 23:01 0000000100000003 +0000005D -rw------- 1 postgres postgres 16777216 Jul 16 23:04 0000000100000003 +0000005E -rw------- 1 postgres postgres 16777216 Jul 16 23:06 0000000100000003 +0000005F -rw------- 1 postgres postgres 16777216 Jul 16 23:09 0000000100000003 +00000060 -rw------- 1 postgres postgres 16777216 Jul 16 23:12 0000000100000003 +00000061 -rw------- 1 postgres postgres 16777216 Jul 16 23:14 0000000100000003 +00000062 -rw------- 1 postgres postgres 16777216 Jul 16 23:17 0000000100000003 +00000063 -rw------- 1 postgres postgres 16777216 Jul 16 23:20 0000000100000003 +00000064 -rw------- 1 postgres postgres 16777216 Jul 16 23:23 0000000100000003 +00000065 -rw------- 1 postgres postgres 16777216 Jul 16 23:25 0000000100000003 +00000066 -rw------- 1 postgres postgres 16777216 Jul 16 23:26 0000000100000003 +00000067 -rw------- 1 postgres postgres 285 Jul 16 23:26 0000000100000003 +00000067.00000020.bac -rw------- 1 postgres postgres 16777216 Jul 16 23:27 0000000100000003 +00000068 -rw------- 1 postgres postgres 16777216 Jul 16 23:30 0000000100000003 +00000069
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: removing files with perl based on age and name
by graff (Chancellor) on Jul 19, 2014 at 00:19 UTC | |
|
Re: removing files with perl
by Anonymous Monk on Jul 18, 2014 at 09:26 UTC | |
|
Re: removing files with perl based on age and name
by Anonymous Monk on Jul 19, 2014 at 15:40 UTC | |
by Anonymous Monk on Jul 20, 2014 at 02:36 UTC | |
|
Re: removing files with perl based on age and name
by gurpreetsingh13 (Scribe) on Jul 18, 2014 at 10:54 UTC | |
by hippo (Archbishop) on Jul 18, 2014 at 11:31 UTC | |
|