nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

scripting

This is a discussion on scripting within the Shell scripting forums, part of the Development/Scripting category; how to find a file that may be situated anywhere on the system and then delete it if its older ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 09-02-2005, 05:40 PM
ganes
Guest
 
Posts: n/a
Default scripting

how to find a file that may be situated anywhere on the system and then delete it if its older than some days
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-03-2005, 01:40 PM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 581
Rep Power: 7
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default

Hmm...

try something like this:

To list file 5 days ago (modified less than then 5 days ago )
Code:
find /home -type f -mtime -5 -exec ls -lh {} \;
To remove file 5 days ago (modified less than then 5 days ago )
Code:
find /home -type f -mtime -5 -exec rm -rf {} \;
Try and lemee know..
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
  #3 (permalink)  
Old 09-06-2005, 01:04 PM
ganes
Guest
 
Posts: n/a
Default

thanks...its working..what is the effect of sign of 'n' in -mtime
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
perl scripting pansarevai Coding in General 2 03-17-2008 06:34 PM
new to scripting poone1 Shell scripting 0 01-15-2008 02:19 AM
need help on shell scripting rahul_sayz Shell scripting 1 12-08-2007 11:37 AM
new scripting problem, cat | foreach cybergurra Shell scripting 5 03-16-2007 08:00 PM
Learning Shell Scripting ricc Shell scripting 4 08-30-2005 10:37 AM


All times are GMT +5.5. The time now is 09:03 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36