Link to home
Start Free TrialLog in
Avatar of icecom4
icecom4Flag for United States of America

asked on

removing files under a certain size using batch

I am intetested in removing files under a certain size from any directory with a certain name.  So for instance, I want the batch to search multiple drives for folders called "battlequest" and delete any files in those folders under a certain size.  Below is an example of a working script that removes certain size files from a known path, perhaps that can help get you started.  

thanks in advance

pushd "f:\Program Files\games\battlequest"
for %%j in (*.pk3) do if %%~zj lss 1043000 del "%%~j"
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of icecom4

ASKER

this worked but I had to remove the quotes around "\battlequest\"

are they needed for anything?
Avatar of icecom4

ASKER

ok and lastly, is there a command that will make the batch script activity invisable when active?  I know how to minimize the script window "/min" and clear "cls", but any other way to make it not visable to users that execute it?
Not really. Hiding such a window is often considered malicious by AV software. A tool to hide a running window is CmdOW (http://www.commandline.co.uk/cmdow/). You cannot hide the Window from start - for that you would need to start the batch file from e.g. VBS.
Avatar of icecom4

ASKER

ok thanks.  the reason I am asking is because I am developing scripts to removed crappy menus forced on game users by some servers which players concider malicious.  The reason I dont want the script visable is because these server owners will view my script and try to bypass it.  But no worries.  

You mentioned that AV software may concider a script malicious.  Thats cool, so then I won't hide the windows.  Is there anything I should avoid putting in batch scripts that will trigger an AV alert?  I dont want a simple script to be blocked by AV.  

thanks again
Nothing of above will alert an AV. What can be problematic is
contacting an IP address, in particular with http or telnet - considered as very suspicious
accessing system32 folder
using applications containing a just-in-time decompression part
using Remote Control software
using software known to be capable of hiding, resizing, moving of windows
and some more.
Avatar of icecom4

ASKER

I ping a local ip to create a delay.  Is that ok for AV?  

example:  ping 123.45.67.89 -n 1 -w %11500 > nul
ECHO.  done

thanks and I will close after this.  
That is ok, though the   -w %11500   looks strange. I guess it is to add a multiplier of 10 secs as an option if provided on the commandline.