User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 426,935 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,429 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 771 | Replies: 2
Reply
Join Date: Apr 2008
Posts: 7
Reputation: conandor is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
conandor conandor is offline Offline
Newbie Poster

auto check folder size and delete

  #1  
May 28th, 2008
how can i have a automatically check folder size and when the contain of the folder is reach to some limit it will deletes all the contains the files inside.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Posts: 275
Reputation: eggi is on a distinguished road 
Rep Power: 1
Solved Threads: 26
eggi eggi is offline Offline
Posting Whiz in Training

Re: auto check folder size and delete

  #2  
May 28th, 2008
Hey There,

du is a good command to use to check a folder size. Compare that against your baseline (whatever your "too big" limit is) and, at that point, just use rm -rf to remove the contents. You'll probably want to run it in cron if it's a persistent check.

Best wishes,

Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
Reply With Quote  
Join Date: Apr 2008
Posts: 7
Reputation: conandor is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
conandor conandor is offline Offline
Newbie Poster

Re: auto check folder size and delete

  #3  
May 29th, 2008
thanks.
how can i write a cron script for it
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Shell Scripting Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 12:17 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC