WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Newbie ..... is this possible (Read 4289 times)
njb
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Newbie ..... is this possible
Oct 12th, 2004 at 10:52pm
 
using Watchdirectory, is it possible to delete files that have not been modified for a duration of days ( i.e delete all files that have not been modified in the previuos 180 days ).

Thanks
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Newbie ..... is this possible
Reply #1 - Oct 12th, 2004 at 11:19pm
 
Hello "njb",

Sorry, but watchDirectory reacts to events that HAPPEN inside a directory. What you are after is something that didn't happen (no updates in 180 days)...

Your specific example (delete after 180 days), can almost be handled by our freeware GdPUtil program (http://www.gdps.dk/products/watchDir/GdPUtil.shtml):

GdPUtil -deleteolderthan 180 c:\temp

will delete all files that were created more than 180 days ago.
If you ask very politely, I will add an option for this to work  with the modification date.

Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
njb
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Re: Newbie ..... is this possible
Reply #2 - Oct 13th, 2004 at 6:43pm
 
Gert ... this is me asking very nicely     Grin
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Newbie ..... is this possible
Reply #3 - Oct 13th, 2004 at 11:36pm
 
okay, a new version is uploaded.
I didn't change the webpage yet, but you should use -modifiedolderthan instead of -deleteolderthan.

note, some filesystems do not support this modification date (Last Write date), I am not sure what will happen if you run it on such filesystems.

Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
njb
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 3
Re: Newbie ..... is this possible
Reply #4 - Oct 14th, 2004 at 5:30pm
 
Thanks GERT, new version downloaded, I will test and let you know if I have any issues.

Nigel
Back to top
 
 
IP Logged
 
jesper
YaBB Newbies
*
Offline


www.gdps.dk/pro ducts/watchDir/
GdPUtil.shtml

Posts: 17
Copenhagen
Re: Newbie ..... is this possible
Reply #5 - Oct 17th, 2004 at 3:45am
 
This is very useful, thanks.

Could it be modified to take hours or even minutes as argument instead of days? Smiley

And could it work across subdirs? Useful for cleaning
out old logfiles for example.

On top of this, it would be nice to add a -test, which would just echo the files that _would_ have been deleted.

Similar to tmpwatch:
http://linux.maruhn.com/sec/tmpwatch.html
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Newbie ..... is this possible
Reply #6 - Oct 17th, 2004 at 7:29am
 
Hej Jesper!

Det er godt 'ideas' (my danish is getting really bad these days, sorry).

Anyway, those are good ideas, expect an update soon.....

mvh,
Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
jesper
YaBB Newbies
*
Offline


www.gdps.dk/pro ducts/watchDir/
GdPUtil.shtml

Posts: 17
Copenhagen
Re: Newbie ..... is this possible
Reply #7 - Oct 17th, 2004 at 3:31pm
 
Hej

Reading through the archives i was hoping for a positive and swift response, and once again you impress! I will be looking forward to the update, thank you Smiley

Jeg er i tvivl om det danske islæt, med .dk domæne og danskklingende navn Gert, så er det jo nærliggende at tro i er et dansk firma. (Well better keep it english for the rest of the audience)!


Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Newbie ..... is this possible
Reply #8 - Oct 17th, 2004 at 4:57pm
 
Jesper,

I used to live in Silkeborg for about 1 year. The problem was: my girlfriend and kids all spoke english so there was no pressing reason to learn Danish.

Anyway, I have uploaded version 1.8 of GdPUtil a few minutes ago.

Quote:
  -deleteolderthan days directory [filemask] [-force] [-subdirs] [-test] [-hours]
     Deletes all files in <directory> that are created more than <days> days ago
     filemask: only for files matching this mask, for example *.log
           (if no filemask is specified, *.* is used)
     -force: reset read-only attribute before trying to delete
     -subdirs: also remove files from subdirectories
     -test: do not delete files, just report the files that would be deleted
     -hours: interpret "days" as hours instead
     Example:
       GdPUtil -deleteolderthan 14 c:\temp *.log -subdirs
       will delete all log-files older than 14 days from C:\Temp and below
  -modifiedolderthan days directory [filemask] [-force] [-subdirs] [-test] [-hours]
     see -deleteolderthan. Uses the Last Write time of the file, instead of the creation date.
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
jesper
YaBB Newbies
*
Offline


www.gdps.dk/pro ducts/watchDir/
GdPUtil.shtml

Posts: 17
Copenhagen
Re: Newbie ..... is this possible
Reply #9 - Oct 17th, 2004 at 5:15pm
 
Smiley

Thank you very much, testing it now!

Back to top
 
 
IP Logged
 
jesper
YaBB Newbies
*
Offline


www.gdps.dk/pro ducts/watchDir/
GdPUtil.shtml

Posts: 17
Copenhagen
Re: Newbie ..... is this possible
Reply #10 - Oct 17th, 2004 at 5:50pm
 
Works perfect, and fast too!

I have missed that default behaviour does not remove empty dirs, for example after all the files are removed, leaving a lot of empty dirs behind.

Can you add a -dirs for "Also remove empty directories"?

Or change default behaviour then adding this:
      -d, --nodirs
             Do not attempt to remove directories, even if they are empty.
From tmpwatch manpage:
http://www.freebsd.org/cgi/man.cgi?query=tmpwatch&apropos=0&sektion=0&manpath=Fr...

Just another suggestion Smiley
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Newbie ..... is this possible
Reply #11 - Oct 17th, 2004 at 6:22pm
 
... and I thought to have a nice and quiet sunday morning...
Okay, uploaded a new version. Use "-removeempty" for this.

It will only work properly for leaf directories. Directories that have subdirectories (even if those subdirectories are deleted by this switch) won't be removed.

However, you can run GdPUtil a few times in a row using the same switches.

Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
jesper
YaBB Newbies
*
Offline


www.gdps.dk/pro ducts/watchDir/
GdPUtil.shtml

Posts: 17
Copenhagen
Re: Newbie ..... is this possible
Reply #12 - Oct 17th, 2004 at 7:06pm
 
... and as expected, it works, thank you Gert!
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1