Computing.Net > Forums > Programming > Get a Folder size in a batch file

Get a Folder size in a batch file

Reply to Message Icon

Original Message
Name: jconner
Date: February 18, 2004 at 18:18:16 Pacific
Subject: Get a Folder size in a batch file
OS: win 2k RH9
CPU/Ram: 2.6 1 gig ram
Comment:

I am trying to get a folder size in a batch file but can't figure it out.
is there a way???
thanks,


Report Offensive Message For Removal


Response Number 1
Name: Code One
Date: February 18, 2004 at 18:34:59 Pacific
Reply: (edit)

dir [path]
pause


Report Offensive Follow Up For Removal

Response Number 2
Name: jconner
Date: February 18, 2004 at 21:59:24 Pacific
Reply: (edit)

I need the size of folders in kb,mb gb...
or just b...
dir doesn't list the size of folders, only files.
for example: on linux I can type
du -h --max-depth=1 /home/js/dir.txt
and that gives me the size of only directories.
I am trying to write a windows batch file to sort folders into groups of <700mb for backing up to cd


Report Offensive Follow Up For Removal

Response Number 3
Name: drigz
Date: February 19, 2004 at 04:48:30 Pacific
Reply: (edit)

why batch? if say your are in c, and you want to kno the size of windows, you could run dir c:\windows, although it would not account for folders inside windows.



Report Offensive Follow Up For Removal

Response Number 4
Name: jconner
Date: February 19, 2004 at 14:13:44 Pacific
Reply: (edit)

I have a little over 200 gigs of data That I need to back up to CD or DVD depending on size.
Some folders are under 1 meg, and some are over 3gigs. For simplicity, I need to keep from breaking up folders on to multiple CDs. In addition, I need to keep the original location and naming just incase I need to load them back to the server. All of these folders contain linked items so if they are renamed or not in the same directory I would not be able to use them.
I am able to do this easily with Red Hat Linux. But, I would like our staff to be able to do it and they are not familar with linux.
Here is the format I get from Linux:
5m folder1
1.g folder2
I would like to get something similar in windows with either C++, or a batch.

Thanks Again for any help!!!


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Get a Folder size in a batch file

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge