LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-17-2005, 11:38 AM   #16
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,003

Rep: Reputation: 624Reputation: 624Reputation: 624Reputation: 624Reputation: 624Reputation: 624

i think my suggestion on the reverse page is progammatically the sanest to flush out.

the only exception you would have to handle is jan 1st - jan 21st.

an extra credit 2 points if someone can handle this special case not so painfully:

Last edited by schneidz; 11-17-2005 at 11:44 AM.
 
Old 11-18-2005, 03:24 AM   #17
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: FreeBSD, Debian, Mint, Puppy
Posts: 3,287

Rep: Reputation: 173Reputation: 173
sorry, I think mine's better.

simple and no special cases.
 
Old 11-19-2005, 03:59 PM   #18
eddiebaby1023
Member
 
Registered: May 2005
Posts: 378

Rep: Reputation: 33
Quote:
Once I realized that I could use PHP by changing the she-bang line
You can use any program in that line - the semantics are that the command and arguments after the "#!" is run with the file connected to its stdin. The "#!" must be characters 1 and 2 (or 0 and 1 if you're a C programmer!) in the file.
 
Old 11-22-2005, 02:59 PM   #19
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,003

Rep: Reputation: 624Reputation: 624Reputation: 624Reputation: 624Reputation: 624Reputation: 624
bigears!, you'll end with last comment for the last time

seriously, i couldn't get '-ctime' to work.

sorry for late response everyone but i put this away for a while.

does anyone like this code? (this is assuming that the folder name is appended with '.day-of-year')?:
Code:
 :/temp/bmj> cat bmj.ksh
#!/usr/bin/bash

currdate=`date +%j`
for dir in `ls -1 | grep hello-world`
do
 dirdate=`echo $dir | awk -F . '{print $2}'`
 diffdate=`expr $currdate - $dirdate`
 if [ $diffdate -gt 21 ]; then
  rm $dir
 fi
done
disclaimer: wont work for first 3 weeks of the new year.

Last edited by schneidz; 11-23-2005 at 01:37 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH Shell Scripting -- foreach file in folder??? AC97Conquerer Programming 11 07-06-2011 12:25 AM
how to tell bash to move files to another folder? hq4ever Linux - Newbie 10 12-30-2010 03:15 AM
ROX-filer: file deletion and trash folder woland Linux - Software 0 08-22-2004 11:16 PM
automate deletion of old email? LC9 Linux - Software 0 12-08-2003 02:03 PM
Automatic deletion of spam folder? RKris Linux - General 1 05-27-2003 08:21 AM


All times are GMT -5. The time now is 05:36 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration