Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 9116
  • Last Modified:

Dos File Size Script

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
CMILLER
Asked:
CMILLER
3 Solutions
 
Trygve ThayerCommented:
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
 
Trygve ThayerCommented:
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
 
akubiCommented:
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
Industry Leaders: 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!

 
CMILLERAuthor Commented:
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
 
BrianGoCommented:
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
 
Trygve ThayerCommented:
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
 
CMILLERAuthor Commented:
Thanks, to all
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now