Need some help with compression / move script

Reply

Join Date: Aug 2007
Posts: 165
Reputation: Fest3er is an unknown quantity at this point 
Solved Threads: 18
Fest3er Fest3er is offline Offline
Junior Poster

Re: Need some help with compression / move script

 
0
  #11
Jul 7th, 2008
Originally Posted by psmawson View Post
like the script blue,

would it be possible to get a script that could then remove the zipped up .dem files after they become 6months in age to keep down the disk space been used?

Would be a useful and great extra
Of course it is possible. Don't be ridiculous.

Sorry, I couldn't resist stealing a line from an old TV sitcom.

On a GNU system, the following script should work.
Shell Scripting Syntax (Toggle Plain Text)
  1. #!/bin/bash
  2.  
  3. REP="/var/www/html/hltv/cztv" # Copying directory
  4. TMP_PATTERN="/tmp/cztv_pattern"
  5.  
  6. # First, create a file dated 6 months in the past
  7. touch -d "6 months ago" ${TMP_PATTERN}
  8.  
  9. # Now find all files in the target directory that are not newer
  10. # than the pattern, and delete them. Do NOT descend into
  11. # sub-directories (if any)
  12. find ${REP}/* -prune ! -newer ${TMP_PATTERN} -exec rm -f {} \;
  13.  
  14. # Finally, delete the pattern
  15. rm -f ${TMP_PATTERN}

Warning: this script is not tested. I'm fairly certain the command syntax is correct, though. Test it thoroughly before deploying it!

N
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 1
Reputation: Spoon12 has a little shameless behaviour in the past 
Solved Threads: 0
Spoon12 Spoon12 is offline Offline
Newbie Poster

Re:

 
-1
  #12
Aug 3rd, 2009
Do you by chance live in the FT Lauderdale area?
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 165
Reputation: Fest3er is an unknown quantity at this point 
Solved Threads: 18
Fest3er Fest3er is offline Offline
Junior Poster

Re:

 
0
  #13
Aug 5th, 2009
Originally Posted by Spoon12 View Post
Do you by chance live in the FT Lauderdale area?
Please specify.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Shell Scripting Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC