« Previous Next »

Thread: View the size,name and Path of a directory

Last post 01-19-2007 11:26 AM by LogParser User : Jeff. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 01-12-2007, 8:04 AM

    View the size,name and Path of a directory

    I have an share with an lot af users.

    How do i see size of their folder, where it is and with user it is.

    Becuase i dont path over every file, there is in a folder, only the toplevel folder

    Something like this

    name size path
    TPJ 10mb D:\shares\tpj

    Anybody, there have an idea how to do this ?
  • 01-19-2007, 9:21 AM In reply to

    RE: View the size,name and Path of a directory

    In order to find the size of a folder, the LP FS input format must group by that folder and SUM() the size of every file in it.
    Here is a query that does something like that. It might be able to be tweaked to your use:

    SELECT ShareDir, SUM(Size) AS FolderSize
    USING EXTRACT_PREFIX(Path, 2, '\\') AS ShareDir
    FROM C:\tmp\*
    WHERE Name NOT IN ('.'; '..')
    GROUP BY ShareDir
  • 01-19-2007, 11:26 AM In reply to

    RE: View the size,name and Path of a directory

    My implementation is slightly different:

    select
         extract_token(path,add(1,strcnt('%CD%','\\')),'\\') as dir,
         sum(size) as sumsize

    from
         '%CD%\*'
    where 
          Name not in ('.';'..')

    group by
         dir

    order by
         sumsize
    desc

    Note, if you save it as a file you have to call it like:

    logparser -i:fs file:getdiskspace.sql?CD=%CD%

    (%CD% isn't a real environment variable - so Log Parser can't find it)

Page 1 of 1 (3 items)
Microsoft Communities