WatchDirectory Forum
watchDirectory forums >> Plugins >> Auto Delete files of a size

Message started by trogers on Jul 18th, 2007 at 8:44pm

Title: Auto Delete files of a size
Post by trogers on Jul 18th, 2007 at 8:44pm
Ok, have seen several topics close to this question, but the each appear to differ slightly in a material way so I thought I would ask my specific question.  

I am running a bat file which queries data and produces a file into a specific directory.  The size of the file created is dependant on the result of the query.  I need to delete (as soon as it's created) every file of less than a certain size.

I saw the size variable available for functions other than delete.  Can anyone help me get this done?

Title: Re: Auto Delete files of a size
Post by Gert on Jul 19th, 2007 at 3:06pm

There is no option to select only files of a certain size. However, what you can do is make use of the environment variables that watchDirectory creates before it runs your batch script (see for the complete list). Then let WD run a .bat file for all new files, and let the batch script delete files based on their size.
For example:
[code]IF %WD_FILE_SIZE% LEQ 1024 DEL "%WD_FILE%"[/code]
The above deletes all files smaller or equal to 1024 bytes.


WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2017. All Rights Reserved.