Solved

Dos File Size Script

Posted on 2004-04-21
7
9,087 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now