Krish Na
Krish Na

Reputation: 39

Batchscript to delete file more than 200kb

can anyone pls explain the below command

FORFILES /S /M *.imp /C "cmd /c if @fsize gtr 200000 del @file"

I want to delete the .imp file if the file is more than 200kb. I got the command but when I try to put the path //flxxx/g_ff_gg$/CDO_MTK_SMT/Hari krishna/gggg_SCRIPTS/ I am getting an error. Where shall I put the path in the above command.

or is there any command to check the file which is more than 200kb and deletes the file with the given directory

Upvotes: 0

Views: 177

Answers (1)

zzeroo
zzeroo

Reputation: 5636

One possible solution, I use in such cases, is to first change into the directory. Then call the command and final leave. pushd and popd are made for such actions.

pushd \\ComputerName\ShareName\Directory1\Directory2
FORFILES /S /M *.imp /C "cmd /c if @fsize gtr 200000 del @file"
popd

Upvotes: 1

Related Questions