Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Site Related Forums
 The Yak Corral
 File Deleter

Author  Topic 

jhermiz

3564 Posts

Posted - 2007-02-05 : 08:52:06
I was wondering if anyone knew if there was any software out there that looks in a folder and after a certain number of files or a date that it goes in there and purges a file.

Better yet like a FIFO (First in first out), but only after hitting a limit or peek. We have work for a specific customer where an AXIS camera takes pics of some stations and stores the images. The images get fairly large and take up space. So was hoping that there was some app out there that looks at the number of files and takes out what came in there first, maybe like one at a time.

Prolly would have to write this myself but was just wondering if anyone has seen software like this ?



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]

RS Blog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-02-05 : 08:59:44
Why? This task probably can be handled by writing a batch file also with a for loop in it.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-02-05 : 09:02:30
The way that I do these, quick&dirty, is to rename the folders, or files.

So for log files we do:

DEL MyLog10.LOG
REN MyLog09.LOG MyLog10.LOG
...
REN MyLog01.LOG MyLog02.LOG
... create new MyLog01.LOG file ...

and after 10 "gos" the oldest file is dropped. No need for complicated "if older than" type logic.

We do similar stuff with Folder names. We have a backup, on disk, of our source code repository (SubVersion) which requires a special EXE that dumps the online-repository to a folder. So we rename round-robin the last 10 folders. They get pushed to tape, but if the tape doesn't work for a couple of days the disk copies give us some safety-net.

Dunno if you can translate that into what you are doing though. Clearly you don't want to rename the files!

Perhaps ECHO the filename to a FIFO Text File, and have a Batch operation process that to permit N-keepers, and delete the rest? (and make a new FIFO text file)

A Batch file can use the FOR command to extract, and act on, the Date/Time and/or Size of a file. So that might be another route (type "FOR /?" at command prompt and see "%~tI" and "%~zI" options - all of them are a bit cryptic I'm afraid!)

Kristen
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-02-05 : 10:56:03
take a look at the FileSystemWatcher component in .net
It has events that you can subscribe to when a certian criteria for files/folders is reached.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -