Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unix file dates

Status
Not open for further replies.

timi

Technical User
Nov 10, 2001
35
HU
Hi all Wondering if you can help me with some Idea how to code this scenario.

I have to collect logs from certain folders however I want to only collect some from a certain date.
I have written a program to collect all the logs from the folders and zip them up but this still gives me about a 22 meg file to download over a modem.

I would like to add into my script to be able to prompt the user to enter a date or range of dates, read this in and then take the variables to and use them to collect only those logs.... any Ideas ?

Thank you all
 
Suggestion:
DATE=$1
# the following line, you may change ${DATE:-7} to ${DATE}, just want to provide a default value to the script.
find /path -mtime +${DATE:-7} -name 'your_log_name' -exec gzip {} \;

tikual
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top