Solved

Dos File Size Script

Posted on 2004-04-21
7
9,091 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
7 Comments
 
LVL 3

Expert Comment

by:tthayer
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:tthayer
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 180 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
The New “Normal” in Modern Enterprise Operations

DevOps for the modern enterprise offers many benefits — increased agility, productivity, and more, but digital transformation isn’t easy, especially if you’re not addressing the right issues. Register for the webinar to dive into the “new normal” for enterprise modern ops.

 

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 280 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:tthayer
tthayer earned 40 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.

808 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