If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Remove Files according to System Date instead of File Names

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-03-06, 22:05
process process is offline
Registered User
 
Join Date: Jan 2005
Posts: 13
Remove Files according to System Date instead of File Names

Hi all,

I am currently developing a shell script whereby i will need to put it up as cronjob to remove excess files in memory.

Here is how it goes. For example today is Monday and i assign a variable $date_char = Mon with reference the system date.

Then i will need to delete all the files under the system date with Mon instead of the file names with "Mon".

Here is my draft script.

#!/bin/csh
set date_char=`date +%a`
set date_now=`date +%y%m%d`
echo $date_now
echo $date_char
if ($date_char = Mon) then
cd /scripts/data/
rm storage_bin.000%
else if ($date_char = Tue)
cd /scripts/data/
rm storage_bin.000%
else if ($date_char = Wed)
cd /scripts/data/
rm storage_bin.000%
endif
exit
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On