Reputation: 1
How to delete a specific file, in a specific location, if the file is larger than given size, in a batch file.
Basicly what I am trying to do is create a batch file that when run will always delete a specific file if its size is larger than 100mb.
Upvotes: 0
Views: 50
Reputation: 70923
for %%a in ("c:\somewhere\theFile.txt") do if %%~za gtr 104857600 del "%%~fa"
The for
command will get a reference to the indicated file in its replaceable parameter %%a
. Then %%~za
will return the size of the referenced file, and %%~fa
is the file name with full path.
Upvotes: 1