Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dos File Size Script

Posted on 2004-04-21
7
Medium Priority
?
9,110 Views
Last Modified: 2007-12-19
I have a NT4.0 BDC, that has a users dir with all my 100 users.

I need a script to get the size or used space for that dir.

example:

d:/users/millerc$
0
Comment
Question by:CMILLER
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 3

Expert Comment

by:Trygve Thayer
ID: 10885508
I might be overlooking something but if this is just one directory just go to Start...Run...and type in CMD and press enter.  Navigate to the directory and type dir and press enter.  It will scroll through and at the end tell you how much space is used in that directory in BYTES.
0
 
LVL 3

Expert Comment

by:Trygve Thayer
ID: 10885532
To put this in a script just create a batch file.  Open a text editor and type something like this and save it as a  ???.bat file.  Then create an shortcut to the batch file and open it

@ECHO OFF

REM This is the drive letter the directory is located on
C:
REM This sets the Drive letter to the root directory
CD\
REM  This navigates you to the directory (for example say you wanted to go to C:\windows\system
CD WINDOWS
CD SYSTEM
REM Enter the command to search the directory
DIR
REM Pause the screen so you can read it
PAUSE
ECHO       Press enter to exit back to the desktop  
0
 
LVL 1

Assisted Solution

by:akubi
akubi earned 720 total points
ID: 10886884
I'm guessing you want to know the total amount of space a particular user is using, meaning everything in all the subdirectories as well.

In that case what you want to use is the "/s" argument for the dir command.

If all your users directories are in d:\users, create batch file with the following inside:
--------------------------------------howmuch.bat
dir  d:\users\%1  /s
--------------------------------------

Now, whenever you want to see how much space a user named millerc is using,
enter "howmuch millerc"

The last three lines will say something like:
Total Files Listed:
       5712 File(s)  3,378,971,669 bytes
       1955 Dir(s)  54,177,785,856 bytes free
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:CMILLER
ID: 10893956
sorry, I didnt explain very well

AKUBI, you are on track.

I want to have a file that lists all 100 users
total files listed

ex: output file

millerc
Total Files Listed:
       5712 File(s)  3,378,971,669 bytes
       1955 Dir(s)  54,177,785,856 bytes free
joeuser1
Total Files Listed:
       5712 File(s)  3,378,971,669 bytes
       1955 Dir(s)  54,177,785,856 bytes free
joeuser2
Total Files Listed:
       5712 File(s)  3,378,971,669 bytes
       1955 Dir(s)  54,177,785,856 bytes free

0
 

Accepted Solution

by:
BrianGo earned 1120 total points
ID: 10895864
Microsoft has a free commandline utility that does just what you are looking for.  It's called Diruse.exe.  Here's a link to their site.  

http://www.microsoft.com/windows2000/techinfo/reskit/tools/existing/diruse-o.asp

It accepts flags and you can use the greater than flag to pipe it to a file.  
IE: DirUse.exe c:\ >c:\log.txt
You'd have to write a parser for the file if you wanted to do anything with the information.  

Another option is to write something in vb/vbscript that recursively runs through directories tallying up the file sizes.  It all depends on what you want to do with the information.

Here's some sample output run on my machine.  

C:\Program Files\Resource Kit>diruse /m /, /* c:\

    Size (mb)  Files  Directory
        68.29   2685  SUB-TOTAL: C:\Documents and Settings
     2,439.74     29  SUB-TOTAL: C:\downloads
         0.31      8  SUB-TOTAL: C:\EPSCAN2
       487.96   6345  SUB-TOTAL: C:\i386
         0.14     21  SUB-TOTAL: C:\Inetpub
       290.40    111  SUB-TOTAL: C:\MSOCache
     2,262.85   8697  SUB-TOTAL: C:\Program Files
       115.12     12  SUB-TOTAL: C:\RECYCLER
         0.02      1  SUB-TOTAL: C:\System Volume Information
         0.00      0  SUB-TOTAL: C:\WebApps
     1,653.17  10412  SUB-TOTAL: C:\WINDOWS
         0.00      0  SUB-TOTAL: C:\wmpub
         0.00      0  SUB-TOTAL: C:\WUTemp
     7,317.99  28321  TOTAL
0
 
LVL 3

Assisted Solution

by:Trygve Thayer
Trygve Thayer earned 160 total points
ID: 10895868
Well you could do something like this.  It will print each to a printer.  If you are using a network printer you can capture the network printer to the LPT1 port

@ECHO OFF

C:
CD\
CD Users
CD millerc
DIR *. /s >LPT1
CD..
CD joeuser1 > LPT1
DIR *. /s
CD..
CD joeuser2
DIR *. /s >LPT1
ECHO......       Press enter to exit back to the desktop  
0
 

Author Comment

by:CMILLER
ID: 10902815
Thanks, to all
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Progress
Introduction to Processes

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question