Wednesday, August 28, 2013

DELETE FILES OLDER THAN x DAYS IN LINUX.



Linux has find utility to delete the files in the specified folder older than x days where value of x is entered by the user.
The example below illustrates the implementation of this utility:

# find /path/to/files* -mtime +x -exec rm {} \;

In the example above ,

The first argument /path/to/files is the location of the folder from where the files are deleted.

The second -mtime specifies number of days old that the file is. For example, +x will find files older than x days.

The third argument – exec allows user  to pass in a command such as rm while {} \; at the end is required to end the command.
 
 
 
http://cbitss.com/6-months-industrial-training.html
 

0 comments:

Post a Comment