Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

XCOPY folder sizes

Posted on 2006-06-09
14
Medium Priority
?
613 Views
Last Modified: 2008-02-01
Hi, i want to list folders (and all subfolders) with total size of each folder.

Can i do this with a simple line command in xcopy?

Thanks


0
Comment
Question by:xenium
  • 5
  • 4
  • 3
  • +1
13 Comments
 
LVL 96

Accepted Solution

by:
Lee W, MVP earned 240 total points
ID: 16873976
0
 

Author Comment

by:xenium
ID: 16874028
Thanks. What's the command?
0
 
LVL 10

Assisted Solution

by:GuruGary
GuruGary earned 260 total points
ID: 16874160
For all folders in the current directory you would use:
diruse /* .\

From help:
========================================
Syntax:
DIRUSE displays a list of disk usage for a directory tree(s). Version 1.20

DIRUSE [/S | /V] [/M | /K | /B] [/C] [/,] [/Q:# [/L] [/A] [/D] [/O]] [/*] DIRS

/S      Specifies whether subdirectories are included in the output.
/V      Output progress reports while scanning subdirectories.  Ignored if /S is
 specified.
/M      Displays disk usage in megabytes.
/K      Displays disk usage in kilobytes.
/B      Displays disk usage in bytes (default).
/C      Use Compressed size instead of apparent size.
/,      Use thousand separator when displaying sizes.
/L      Output overflows to logfile .\DIRUSE.LOG.
/*      Uses the top-level directories residing in the specified DIRS
/Q:#    Mark directories that exceed the specified size (#) with a "!".
        (If /M or /K is not specified, then bytes is assumed.)
/A      Specifies that an alert is generated if specified sizes are exceeded.
        (The Alerter service must be running.)
/D      Displays only directories that exceed specified sizes.
/O      Specifies that subdirectories are not checked for specified size
        overflow.
DIRS    Specifies a list of the paths to check.

Note:   Parameters can be typed in any order. And the '-' symbol can be
        used in place of the '/' symbol.

        Also, if /Q is specified, then return code is ONE if any directories are
 found that
        exceed the specified sizes.  Otherwise the return code is ZERO.

Example: diruse /s /m /q:1.5 /l /* c:\users
========================================
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 16

Expert Comment

by:PaulCaswell
ID: 16874197
Hi xenium,

Try:

http://uk.geocities.com/xshareware/download/xdir.zip

command line

xdir /S "/form=*f,*S" /dirs /nofiles

Manual here:

http://uk.geocities.com/xshareware/manuals/xdir_manual.htm

Paul
0
 

Author Comment

by:xenium
ID: 16874278
leew, thanks - was the simple example you gave i needed.
0
 

Author Comment

by:xenium
ID: 16874291
Alternative solution without any tools... produces a not-very-friendly listing but works:

dir *.* /s/a >_size.txt
find /v ":1" _size.txt > size.txt
find /v ":2" size.txt > _size.txt
find /v ":3" _size.txt > size.txt
find /v ":4" size.txt > _size.txt
find /v ":5" _size.txt > size.txt
find /v ":6" size.txt > _size.txt
find /v ":7" _size.txt > size.txt
find /v ":8" size.txt > _size.txt
find /v ":9" _size.txt > size.txt
find /v ":0" size.txt > _size.txt
find /v "----------" _size.txt > size.txt
del _size.txt
0
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 16874302
Sorry, I didn't get back to the question in time to give the example - that was the help file given by GaryGuru - I'd appreciate it if you'd split the points.
0
 

Author Comment

by:xenium
ID: 16874322
PaulCaswell, thanks for tip - may be useful but i not tested it - diruse working fine.
0
 

Author Comment

by:xenium
ID: 16874329
Oops, i didn't even notice it was someone else was answering!

Ed - pls re-open or split for leew/GuruGary
0
 
LVL 16

Expert Comment

by:PaulCaswell
ID: 16874334
>>may be useful but i not tested it
Try it, you'll like it. You can do a whole lot of things with files and folders. I ought to know, I wrote it! {-)

Paul
0
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 16874362
Note: Your Dir/find solution won't actually get you accurate information - IF there are folders you don't have access to.  Diruse is not limited by security - it's the only utility I've found that isn't. I haven't checked it, but I THINK PaulCaswell's will have the same security problem.

Security as in NTFS permissions don't permit you access.
0
 
LVL 16

Expert Comment

by:PaulCaswell
ID: 16874395
>>will have the same security problem

It almost certainly does! I'd never thought to test it in that environment. Thanks!

Paul
0
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 16874414
I consider a good test - find a machine with System Restore (and the System Volume Information folder) and use DIRUSE to check the size.  Then use your util.  Likewise, setup some folders that you don't have access to and see what happens.  Would love to see another util work... but so far...
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

772 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