Avatar of icecom4
icecom4
Flag 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"
Windows XP

Avatar of undefined
Last Comment
Qlemo

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Qlemo

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
icecom4

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

are they needed for anything?
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?
Qlemo

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.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
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
Qlemo

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.
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.  
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Qlemo

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.