RE: remove old files from dictory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This will delete the files.  You will want to run some tests using the
-print option on a subdirectory to verify that you are indeed identifying
and will be removing the files that you want first.

To test:
find <put the path of the start directory here> -ctime +730 -print

To run:
find <put the path of the start directory here> -ctime +730 -exec rm {} \;

This can take quite a while.  I would suggest having multiple sessions
running on the subdirectories to reduce the time.  Also, as for deleting the
directories/subdirectories, you were not clear on whether the timestamp was
the only deciding factor.  I would make a second pass and remove only the
empty directories with the rmdir command.  Read up on the find command for
more information.  Also, make sure you have a backup of the directories
before starting on this.

Patti


-----Original Message-----
From: Jianping Zhu [mailto:jzhu@xxxxxxxxxxxxxxxxxxxxxxx] 
Sent: Tuesday, January 04, 2005 12:34 PM
To: redhat-list@xxxxxxxxxx
Subject: remove old files from dictory

 OS redhat 9.0
 I have a huge direcory (more than 30 GB) I want to take all the files and
 sub-dirctries which are created more than 
 two year ago out of the dicctory. Does anyone have a script to do this
 kind of work? 
 Thank

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux