Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Directory Size

Status
Not open for further replies.

bubba100

Technical User
Nov 16, 2001
493
US
Hi everyone I am trying to write a batch file that will backup certain directories-sub directories and files to CD. I am using XCOPY to copy the directories any subs and the files. Is there a way to determine the size of selected DIR/subDIR and files? If the size of the selected directories and files exceeds 700mg I want it to let the person know. I have tried to Google and tried various searches here and not found what I am after.

Thanks for any ideas.
 
I'm sure there is, but I'm not sure the batch language is that rich. Obviously using dir /s would enumerate all the files in all the subdirectories, and you can filter out the line that shows the file size in a batch file, but beyond that, I'm not sure if you could have a test branch like that in a batch file.

Obviously the task is suited to a program, but I'm not sure of one that I could suggest.
 
Thanks Glenn. I am going to show my ignorance but can you explain how to filter. I fumble through batch files learning something with each time.
 
You could always use your batch file to dump the directories and sub-directories to a text file then use gwbasic or qbasic to extract the file size out of individual lines and accumulate total size. But you would need to account for the slack since file sizes don't match drive space used.

If you are good with batch programming and basic you could even build a set of copy programs to work with the individual files that need to be copied.

Ed Fair
Give the wrong symptoms, get the wrong solutions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top