Click here for important information about

Batch file /for delete file filesize 1MB

May 8, 2010 at 12:51:52
Specs: Windows 7 Ultimate, 4GB
Hi, I'm trying to understand /FOR command, so I created a batch file to delete a file when it is 1MB or bigger, but since I didn't understand FOR command because the syntax is very complex could someone help me? I want to create a bath file as the following:

ECHO (lots of characters) >> file
FOR file > 1MB goto x
goto n
delete file
ECHO File Deleted!

See More: Batch file /for delete file filesize 1MB

May 25, 2010 at 04:03:12
You posted in the wrong Forum (Windows NT) while your system is Windows 7. The question has to be posted in the Programming Forum as it is related to scripting. Anyway here a batch that deletes all files greater then 1024 x 1024 bytes (1 MB) in a directory. To know more at prompt type For /? and If /?

@echo off
pushd "MY Directory"
for %%j in (*) do if %%~zj gtr 1048576 del "%%~j"

Report •
Related Solutions

Ask Question