Solved

Batch Command for Folder sizes

Posted on 2004-10-26
1,633 Views
Last Modified: 2009-10-08
I am creating a batch file for moving a few folders for safe keeping, and i'm need to have it send me a net send with the folder sizes if possible, so i can,

1. know when the copy is finished.
2. check that it copied everything.

Is there an easy command to do this, I would like to learn WSH but I dont have the time to learn it to implement this.

and can information like this be piped to a net send?
0
Question by:mesach
    9 Comments
     
    LVL 9

    Expert Comment

    by:DrWarezz
    >"I am creating a batch file for moving a few folders for safe keeping"
    >" check that it copied everything."

    Do you want to copy or move?
    0
     

    Author Comment

    by:mesach
    Im using Xcopy with the Switches /E /H /K /R /V /Y, If there are better ones let me know.
    0
     
    LVL 9

    Expert Comment

    by:DrWarezz
    No, I think XCOPY is the best to use here.

    I'm gradually working out how to get the dir size at the moment for you, I'll get back to you soon. :)

    [r.D]
    0
     
    LVL 9

    Accepted Solution

    by:
    if you have access to the Resource Kit, its DirUse  command will give you folder sizes.

    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
     

    Author Comment

    by:mesach
    Gilbar that looks like it might work for me, but I cannot seem to make it give me the size of the files in the top level dir,

    diruse /S /, /* C:\Test2

    returns

        Size  (b)  Files  Directory
              650      2  C:\TEST2\New Folder
              650      2  SUB-TOTAL: C:\TEST2\New Folder

              650      2  TOTAL: C:\TEST2\New Folder

    there should be 4 files total

    also the directorys im working with are about 6-10 gig with lots of files, and i cannot seem to keep this from being verbose.

    BTW thanks for all the help
    0
     

    Author Comment

    by:mesach
    also the dir C:\test1 returns an error(the syntax) because there are no directorys within that folder.

    I would have thought there would have been an easy way to get the folder properties
    0
     
    LVL 9

    Expert Comment

    by:gilbar
    i think that's 'cause you're using the /* switch, you could try is with just the /s. We use it for a monthly size check to see which departments are showing too much inflation and instead of using the /s we generate a diruse for each of the dept folders.  
    ps, you're welcome :)
    0
     

    Author Comment

    by:mesach
    Well that gets me the info i need you get the points, now i can go on to getting it to send that to me in a net send! THANKS
    0
     
    LVL 9

    Expert Comment

    by:gilbar
    glad to help!  the resource kit rocks!  I don't know how i'd be able to do my job without it.  Now I can get back to my work ( let me know if you need a vbscript to return the members of all the global groups that are members of a particular domain local group, 'cause i made one today :)
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT Security CISA, CISSP & CISM Certification

    Master the advanced techniques required to protect network resources from external threats with the IT Cyber Security bundle. Built around industry best-practice guidelines, the IT Cyber Security bundle consists of three in-depth courses.

    Suggested Solutions

    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…
    Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
    Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    846 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

    5 Experts available now in Live!

    Get 1:1 Help Now