spacer
spacer search

i-Vibe.com
developer resource & tips portal

Search
spacer
Newsflash
01/27/06: I just had some time to cleanup this website. I will add more articles for AJAX this coming weekend.
 
numbers.jpg
Main Menu
Home
Articles
Programming
Networking/Security
Data Modeling
Interface Design
Developer News
Downloads
Links
Login





Lost Password?
No account yet? Register
Related Articles
 
Home arrow Programming arrow Shell Scripts arrow Delete Old Files In Unix
Delete Old Files In Unix Print E-mail
  • Currently 3.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Rating: 3.0/5 (7 votes cast)

Written by Roceller Alvarez   
Tuesday, 16 May 2006
To delete old files in unix, you can execute the following command from the shell:

find <path> -mtime +30 -exec rm -f {} \;


For example, to delete all file more than 30 days older:

find /tmp -mtime +30 -exec rm -f {} \;


About FIND command:

NAME
     find - find files

SYNOPSIS
     /usr/bin/find path... expression

     /usr/xpg4/bin/find path... expression

DESCRIPTION
     The find utility recursively descends the directory  hierar-
     chy for each path seeking files that match a Boolean expres-
     sion written in the primaries given below.

     find will be able to descend to arbitrary depths in  a  file
     hierarchy  and  will not fail due to path length limitations
     (unless a path operand specified by the application  exceeds
     PATH_MAX requirements).

for more info, type "man find" from your shell.

Comments

Only registered users can write comments.
Please login or register.

Powered by AkoComment 2.0!

 
Next >
spacer
 
spacer