Jump to content

Finding Directory Size through CommandLine


Recommended Posts

Guest JayDee
Posted

This may not even be the right place to ask this, but:

 

Does anyone know a faster way to gather the size of a remote directory

outside of "dir \\server\dir /s" and getting the final size at the

bottom of the output??

 

Thanks

 

- JayDee

  • Replies 6
  • Created
  • Last Reply
Guest Synapse Syndrome
Posted

Re: Finding Directory Size through CommandLine

 

"JayDee" <dopamine@mail.com> wrote in message

news:1761f16c-f486-4de6-acf8-153f9ee9d471@q27g2000prf.googlegroups.com...

> This may not even be the right place to ask this, but:

>

> Does anyone know a faster way to gather the size of a remote directory

> outside of "dir \\server\dir /s" and getting the final size at the

> bottom of the output??

 

 

I have a command called DIRUSE that I have in a directory that I add the

PATH on all my machines, to C:\windows\~command

 

It's from the Windows 2000 Resource Kit. There must be a newer alternative,

and if there is a replacement command, I'd like to hear about it.

 

C:\WINDOWS\~commands\diruse-d.htm

 

ss.

Guest Synapse Syndrome
Posted

Re: Finding Directory Size through CommandLine

 

"Synapse Syndrome" <synapse@NOSPAMsyndrome.me.uk> wrote in message

news:eZr6XS7kIHA.5080@TK2MSFTNGP02.phx.gbl...

>> This may not even be the right place to ask this, but:

>>

>> Does anyone know a faster way to gather the size of a remote directory

>> outside of "dir \\server\dir /s" and getting the final size at the

>> bottom of the output??

>

>

> I have a command called DIRUSE that I have in a directory that I add the

> PATH on all my machines, to C:\windows\~command

>

> It's from the Windows 2000 Resource Kit. There must be a newer

> alternative, and if there is a replacement command, I'd like to hear about

> it.

>

> C:\WINDOWS\~commands\diruse-d.htm

 

 

Oops, wrong link:

 

http://support.microsoft.com/kb/927229

 

ss.

Guest Pegasus \(MVP\)
Posted

Re: Finding Directory Size through CommandLine

 

 

"JayDee" <dopamine@mail.com> wrote in message

news:1761f16c-f486-4de6-acf8-153f9ee9d471@q27g2000prf.googlegroups.com...

> This may not even be the right place to ask this, but:

>

> Does anyone know a faster way to gather the size of a remote directory

> outside of "dir \\server\dir /s" and getting the final size at the

> bottom of the output??

>

> Thanks

>

> - JayDee

 

Try this three-liner:

@echo off

for /F "tokens=3" %%a in ('dir \\server\dir /s ^| find /i "File(s)"') do set

size=%%a

echo Size=%size%

Guest JayDee
Posted

Re: Finding Directory Size through CommandLine

 

On Mar 31, 11:13 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

> "JayDee" <dopam...@mail.com> wrote in message

>

> news:1761f16c-f486-4de6-acf8-153f9ee9d471@q27g2000prf.googlegroups.com...

>

> > This may not even be the right place to ask this, but:

>

> > Does anyone know a faster way to gather the size of a remote directory

> > outside of "dir \\server\dir /s" and getting the final size at the

> > bottom of the output??

>

> > Thanks

>

> > - JayDee

>

> Try this three-liner:

> @echo off

> for /F "tokens=3" %%a in ('dir \\server\dir /s ^| find /i "File(s)"') do set

> size=%%a

> echo Size=%size%

 

that's almost exactly what I'm doing now - but the dir of \\server\dir

in some cases is taking very long when executing over the network... I

doubt there is any way to glean this info without actually doing a dir

though - just wishful thinking. :)

Guest Pegasus \(MVP\)
Posted

Re: Finding Directory Size through CommandLine

 

 

"JayDee" <dopamine@mail.com> wrote in message

news:4957cbe6-1c1f-432c-8016-cdd54dccab3a@b5g2000pri.googlegroups.com...

> On Mar 31, 11:13 pm, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:

>> "JayDee" <dopam...@mail.com> wrote in message

>>

>> news:1761f16c-f486-4de6-acf8-153f9ee9d471@q27g2000prf.googlegroups.com...

>>

>> > This may not even be the right place to ask this, but:

>>

>> > Does anyone know a faster way to gather the size of a remote directory

>> > outside of "dir \\server\dir /s" and getting the final size at the

>> > bottom of the output??

>>

>> > Thanks

>>

>> > - JayDee

>>

>> Try this three-liner:

>> @echo off

>> for /F "tokens=3" %%a in ('dir \\server\dir /s ^| find /i "File(s)"') do

>> set

>> size=%%a

>> echo Size=%size%

>

> that's almost exactly what I'm doing now - but the dir of \\server\dir

> in some cases is taking very long when executing over the network... I

> doubt there is any way to glean this info without actually doing a dir

> though - just wishful thinking. :)

 

This is a different subject altogether. The amount of time is the

same, no matter what tool you use, unless you execute the

command locally. You can easily to this with psexec.exe,

downloadable from http://www.sysinternals.com. If you need this

information regularly then you could schedule this job to run on

your server:

@echo off

if not exist c:\Logs md c:\Logs

for /F "tokens=3" %%a in ('dir \\server\dir /s ^| find /i "File(s)"') do set

size=%%a

echo %date% %time:~0,5% Size of "dir"=%size% >> c:\Logs\Size.log

 

Now all you need to do is examine \\server\c$\Logs\size.log. Even

better, you could get the batch file to send you the information by

EMail once a week.

Guest JohnB
Posted

Re: Finding Directory Size through CommandLine

 

You can try this small script and see if it's any faster than "Dir" (you

have to modify the folder name in the script)

 

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFolder = objFSO.GetFolder("d:\FolderName")

Wscript.Echo "Size: " & objFolder.Size

 

 

"JayDee" <dopamine@mail.com> wrote in message

news:1761f16c-f486-4de6-acf8-153f9ee9d471@q27g2000prf.googlegroups.com...

> This may not even be the right place to ask this, but:

>

> Does anyone know a faster way to gather the size of a remote directory

> outside of "dir \\server\dir /s" and getting the final size at the

> bottom of the output??

>

> Thanks

>

> - JayDee


×
×
  • Create New...