maverh at telenet.be
2012-Jun-19 07:26 UTC
[CentOS] we want to delete all files in a folder except the files with the most recent date
Hi, We want to delete all files in a folder except the files with the most recent date example ls -l jun 3 10:45 file1 jun?3 12:20 file2 jun 2 10:20 file3 jun 2 05:00 file4 jun 1 12:00 file5 jun 1 10:00 file6 jun2 en jun1 must be deleted regards,
John R Pierce
2012-Jun-19 08:33 UTC
[CentOS] we want to delete all files in a folder except the files with the most recent date
On 06/19/12 12:26 AM, maverh at telenet.be wrote:> We want to delete all files in a folder except the files with...man find I suggest you get a book on basic unix systems management. -- john r pierce N 37, W 122 santa cruz ca mid-left coast
Ken godee
2012-Jun-19 14:13 UTC
[CentOS] we want to delete all files in a folder except the files with the most recent date
#!/bin/sh find /files/* -mtime +2 -exec rm {} \; On 6/19/2012 12:26 AM, maverh at telenet.be wrote:> > > Hi, > > We want to delete all files in a folder except the files with the most recent date > example > > ls -l > jun 3 10:45 file1 > jun 3 12:20 file2 > jun 2 10:20 file3 > jun 2 05:00 file4 > jun 1 12:00 file5 > jun 1 10:00 file6 > > jun2 en jun1 must be deleted > > regards, > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >