Solved

Dos File Size Script

Posted on 2004-04-21
7
9,085 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
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 …

747 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

12 Experts available now in Live!

Get 1:1 Help Now