Tom's Guide | Tom's Hardware | Tom's Games | PC Safety Suite
![]() |
![]() |
![]() |
Comment:
Sorry for the double post, I had missed the programming forum and put this under Windows 2000.
I have written a series of batch files which automate a backup process (i.e., run ntbackup > datestamp > etc. > burn discs). Nothing too complicated, basically stringing together a bunch of command line windows executables. Now here comes my problem, some of my file names are predictable, such as the ones regularly backed up and named in the backup process. Other files, however, may be added from time to time which are not predictable. I am requesting some kind of FOR loop which cycles through each file in a given directory and checks the size of each one (or rather, checks to see if any of them are greater than 4,617,089,840 bytes). Alternately, would it at all be possible to assign the name of each file in a directory to a variable? If so, I can figure it out from there using "if ... GTR 4617089840 do".
Here are my concerns:
Is a batch file going to be able to deal with anything over 2GB at all?Would an attempt to pipe the results of a DIR command to a text file and then to parse out the names and sizes of each file be ridiculous?
Also, I would be perfectly happy to use external commands/applications. Anything to get the job done.
Thanks very much in advance!
+1 | ![]() |
Hi Chris
Try This ,it worked in XP Pro ok.@echo off
Rem Echo Filename & Size
cls
for %%a in (dir DirName\*.*) do (
if %%~za GTR 4617089840 (
rem Do want you want here
echo %%a %%~za
)
)
![]() |
batch file problem with %...
|
Batch script
|

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