Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm working on a backup batch program to copy directories to a pen drive somewhat automatically and thought it would be nice to check available space on the pen drive before going through the whole xcopy process on a large directory. I really just need to compare two numbers and determine which is larger but I'm stumped. I've googled my fingers raw.
Can anybody help? The following are examples. 1) directory size, 2)available spaceThanks in advance.
1,307,791,263
1,254,895,616
Mark

What you want to achieve is related to the OS you are running, i.e. that is easy under NT kernel systems (Win NT/2K/XP) but hard in DOS based environments (Win 9X/ME).
Assuming you are running a NT Windows, the code is
Set DirSize=1,307,791,263
Set DirSize=%DirSize:,=%
Set AvSpace=1,254,895,616
Set AvSpace=%AvSpace:,=%If %DirSize% gtr %AvSpace% GoTo :TooHuge
To know more type If /? at prompt (Win NT/2K/XP only).

Thanks dor the response.
Yeah, I forgot to say it was NT. What you described is just what I wanted.
Thanks
Mark

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |