943,840 Members | Top Members by Rank

Ad:
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Jul 7th, 2008
0

Re: Need some help with compression / move script

Click to Expand / Collapse  Quote originally posted by psmawson ...
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
Reputation Points: 51
Solved Threads: 35
Posting Whiz in Training
Fest3er is offline Offline
238 posts
since Aug 2007
Aug 3rd, 2009
-1

Re:

Do you by chance live in the FT Lauderdale area?
Reputation Points: 3
Solved Threads: 0
Newbie Poster
Spoon12 is offline Offline
1 posts
since Aug 2009
Aug 5th, 2009
0

Re:

Click to Expand / Collapse  Quote originally posted by Spoon12 ...
Do you by chance live in the FT Lauderdale area?
Please specify.
Reputation Points: 51
Solved Threads: 35
Posting Whiz in Training
Fest3er is offline Offline
238 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: "set -o notify" for job runing background in Bash
Next Thread in Shell Scripting Forum Timeline: hi all please help me in this issue.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC