drtopserv
asked on
total size of a directory
Hi,
I need a batch to run and check if a total size of a c:\sample (subdirectory and files included) is less than 3 mb in total then delete SAMPLE folder and it`s subdirectories and files within it.
I need a batch to run and check if a total size of a c:\sample (subdirectory and files included) is less than 3 mb in total then delete SAMPLE folder and it`s subdirectories and files within it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There are a couple of free utilities you could use from a BAT script to do this, like:
http://technet.microsoft.com/en-us/sysinternals/bb896651.aspx
http://www.gammadyne.com/cmdline.htm#sizeof
It's pretty hard to do with just BAT commands and no helper utility. The real problem with doing it in BAT is that numbers in BAT are limited to a maximum integer of 2147483648. That's 2GB. So if you were to try and process folders that had sizes that exceed that number then weird stuff starts to happen with BAT arithmetic.
If you want to assume that no folders ever exceed that, then using one of those utils in a BAT file could work, if you want help with that let me know.
~bp
http://technet.microsoft.com/en-us/sysinternals/bb896651.aspx
http://www.gammadyne.com/cmdline.htm#sizeof
It's pretty hard to do with just BAT commands and no helper utility. The real problem with doing it in BAT is that numbers in BAT are limited to a maximum integer of 2147483648. That's 2GB. So if you were to try and process folders that had sizes that exceed that number then weird stuff starts to happen with BAT arithmetic.
If you want to assume that no folders ever exceed that, then using one of those utils in a BAT file could work, if you want help with that let me know.
~bp
ASKER