Petri.com forums Home Forums Start Page Forums Frequently Asked Questions FAQ Member List Members List
Go Back   Petri IT Knowledgebase Forums > Windows Scripting > General Scripting
Petri.com is happy to award RicklesP the title of Most Valuable Member !!!
Register Calendar Calendar Search Petri IT Knowledgebase Forums Search Todays Posts Today's Posts Mark Forums Read
Notices

List of folder and thier size

List of folder and thier size

this thread has 8 replies and has been viewed 6246 times

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 2nd November 2009, 12:17
premglitz premglitz is offline
Casual
It's not a coincidence
 
 Join Date: Mar 2009
  6 month star 12 month star
 Location: Chennai, INDIA
 Posts: 84
 Reputation: premglitz is a Serial Question Askerpremglitz is a Serial Question Asker (-100)
Thumbs up List of folder and thier size

Dear All,
Kindly provide me a script to have a list of folders with the size. This is a shared folder in a server.
This will help me to find which folder have more size and so i can remove unwanted data from the server.

Thanks and answers are appriciated
  #2  
Old 2nd November 2009, 12:33
Wired's Avatar
Wired Wired is offline
Administrator
 
 Join Date: May 2006
  6 month star 12 month star
 Posts: 3,220
 Reputation: Wired is just really niceWired is just really niceWired is just really niceWired is just really nice (384)
Default Re: List of folder and thier size

There's plenty of free scripts / programs on the web for this. Have you checked Google yet?
__________________
** Remember to give credit where credit is due and leave reputation points where appropriate **
  #3  
Old 2nd November 2009, 12:36
L4ndy L4ndy is offline
Moderator
 
 Join Date: May 2006
  6 month star 12 month star
 Location: Liverpool, UK
 Posts: 2,634
 Reputation: L4ndy is a glorious beacon of lightL4ndy is a glorious beacon of lightL4ndy is a glorious beacon of lightL4ndy is a glorious beacon of lightL4ndy is a glorious beacon of lightL4ndy is a glorious beacon of light (541)
Default Re: List of folder and thier size

Try WinDirStat http://windirstat.info/
__________________
Caesar's cipher - 3

ZKHQ BRX HYHQWXDOOB GHFLSKHU WKLV BRX ZLOO UHDOLVH LW ZDV D ZDVWH RI WLPH!

SFX JNRS FC U6 MNGR
  #4  
Old 2nd November 2009, 12:42
premglitz premglitz is offline
Casual
It's not a coincidence
 
 Join Date: Mar 2009
  6 month star 12 month star
 Location: Chennai, INDIA
 Posts: 84
 Reputation: premglitz is a Serial Question Askerpremglitz is a Serial Question Asker (-100)
Thumbs up Re: List of folder and thier size

Hi Wired,
I googled for the result but i cant find the results with folder size. only i get the list of folders and files.

Hi L4andy,
I need a script to export to text file for the list of folders with size. not a software.

Thanks for the quick reply.
But it will be more appreciated on getting the answer for this solution.
  #5  
Old 2nd November 2009, 12:54
premglitz premglitz is offline
Casual
It's not a coincidence
 
 Join Date: Mar 2009
  6 month star 12 month star
 Location: Chennai, INDIA
 Posts: 84
 Reputation: premglitz is a Serial Question Askerpremglitz is a Serial Question Asker (-100)
Thumbs up Re: List of folder and thier size

Hi,
I got a VB script.

Code:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\mov")
Set colSubfolders = objFolder.Subfolders
For Each objSubfolder in colSubfolders
    Wscript.Echo objSubfolder.Name, objSubfolder.Size
Next
But this is giving the size value in bytes. Can anybody modify this to make it in MB format

Last edited by biggles77; 3rd November 2009 at 13:01.. Reason: Wrap text with CODE
  #6  
Old 2nd November 2009, 20:42
Hobie Hobie is offline
Junior Member
Staying around
 
 Join Date: Dec 2008
  6 month star 12 month star
 Location: North Carolina
 Posts: 180
 Reputation: Hobie is on a distinguished road (25)
Default Re: List of folder and thier size

If objSubfolder.Size is in bytes you just need to perform some math to make it different..

bytesize = objSubfolder.Size
kbsize = bytesize / 1024
mbsize = kbsize / 1024

Hobie
  #7  
Old 3rd November 2009, 08:15
premglitz premglitz is offline
Casual
It's not a coincidence
 
 Join Date: Mar 2009
  6 month star 12 month star
 Location: Chennai, INDIA
 Posts: 84
 Reputation: premglitz is a Serial Question Askerpremglitz is a Serial Question Asker (-100)
Thumbs up Re: List of folder and thier size

Dear Hobie,
This doesn't works.
Can you give me the complete script for the same.

Thanks
  #8  
Old 3rd November 2009, 12:25
L4ndy L4ndy is offline
Moderator
 
 Join Date: May 2006
  6 month star 12 month star
 Location: Liverpool, UK
 Posts: 2,634
 Reputation: L4ndy is a glorious beacon of lightL4ndy is a glorious beacon of lightL4ndy is a glorious beacon of lightL4ndy is a glorious beacon of lightL4ndy is a glorious beacon of lightL4ndy is a glorious beacon of light (541)
Default Re: List of folder and thier size

I think he meant something like that:

Code:
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\mov")
Set colSubfolders = objFolder.Subfolders
For Each objSubfolder in colSubfolders
foldersize = objsubfolder.Size/1024/1024                           
Wscript.Echo objSubfolder.Name, int(objSubfolder.Size/1024/1024) & "MB"
Next
However, folder sizes are not very accurate just aproximate. (Ie <1MB will show as 0)

BTW, I thought you wanted to export it to a text file not message box!?
__________________
Caesar's cipher - 3

ZKHQ BRX HYHQWXDOOB GHFLSKHU WKLV BRX ZLOO UHDOLVH LW ZDV D ZDVWH RI WLPH!

SFX JNRS FC U6 MNGR

Last edited by L4ndy; 3rd November 2009 at 12:38.. Reason: smelling pistake !!
  #9  
Old 4th November 2009, 01:32
Rems's Avatar
Rems Rems is offline
Moderator
 
 Join Date: Mar 2005
  6 month star 12 month star
 Location: NL
 Posts: 2,434
 Reputation: Rems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to beholdRems is a splendid one to behold (965)
Default Re: List of folder and thier size

Quote:
Originally Posted by L4ndy View Post
BTW, I thought you wanted to export it to a text file not message box!?
If you run the script with a cscript command line you be able to redirect the output like,
cmd /c cscript.exe /nologo "c:\scripts\scriptname.vbs" > "c:\scripts\outputfile.txt"


Code:
wscript.echo now & vbNewLine

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objParentFolder = objFSO.GetFolder("C:\mov")

rem GetFolderSize objParentFolder

For Each objSubfolder in objParentFolder.Subfolders
   GetFolderSize objSubfolder
Next

wscript.quit

Sub GetFolderSize(Folder)
   on Error Resume next: err.Clear
   Dim lInt, aDecimalPlaces, strSize

   lInt = len(Folder.Size\1024)
   If lInt =< 4 then
     aDecimalPlaces = 1
     strSize = FormatNumber(Round(_
       Folder.Size/1024, aDecimalPlaces), aDecimalPlaces) & " KB"
   ElseIf lInt =< 7 then
     aDecimalPlaces = 2
     strSize = FormatNumber(Round(_
       Folder.Size/1024^2, aDecimalPlaces), aDecimalPlaces) & " MB"
   ElseIf lInt > 7 then
     aDecimalPlaces = 3
     strSize = FormatNumber(Round(_
       Folder.Size/1024^3, aDecimalPlaces), aDecimalPlaces) & " GB"
   End If

   If err.Number <>0 Then
     strSize = "<no access>"
     err.Clear
   End If

   wscript.echo Folder.Path & vbNewLine & _
               "size:", strSize & vbNewLine & _
               "files:", Folder.Files.Count & vbNewLine & _
               "subfolders:", Folder.Subfolders.count  & vbNewLine

   strSize = "<..>"

   rem for each subfolder in Folder.Subfolders
   rem     GetFolderSize subfolder
   rem next

End Sub
\Rems
__________________

This posting is provided "AS IS" with no warranties, and confers no rights.

__________________

** Remember to give credit where credit's due **
and leave Reputation Points for meaningful posts
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Size of Network folder ahmer_sahab General Networking 0 8th July 2009 04:00
How to know size of public folder hierarchy charlsteve Exchange 2000 / 2003 2 20th May 2009 13:29
Archive folder size bschuteker Outlook 3 12th April 2007 14:16
Folder Redirection Size Limits TxJeepers Windows Server 2000 / 2003 / 2003 R2 4 13th February 2007 17:39
How to restrict users not to delete files on thier shares jparmar SBS 2000 / 2003 / 2008 / 2011 2 31st July 2005 10:20


All times are GMT +3. The time now is 02:07.

Steel Blue 3.5.4 vBulletin Style ©2006 vBEnhanced
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
 

Valid XHTML 1.0!   Valid CSS!

Copyright 2005 Daniel Petri