Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
space of single dir on a server dir
I have a dir on a server similar:
\\gcd01f4500\public\user\ in this dir are presents many other dirs is possible to know for each dir in the dir USER the dimension of space used for each dir and store the value of space used in a column of Excel sheet? Note: more dir in USER are are loked but i dont want to navigate in this dir but only to know the dimension of space used for each dir... possible? Tks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
space of single dir on a server dir
I think you can use something like this:
Sub GetFolderSize() strFolder = "C:\SomeFolder\" Set fso = CreateObject _ ("Scripting.FileSystemObject") Set folder = _ fso.GetFolder(strFolder) i = 1 For Each sf In folder.SubFolders Sheets(1).Cells(i, 1) = sf.Name 'folder size in bytes Sheets(1).Cells(i, 2) = sf.Size i = i + 1 Next End Sub Hope that helps. -- urkec "sal21" wrote: I have a dir on a server similar: \\gcd01f4500\public\user\ in this dir are presents many other dirs is possible to know for each dir in the dir USER the dimension of space used for each dir and store the value of space used in a column of Excel sheet? Note: more dir in USER are are loked but i dont want to navigate in this dir but only to know the dimension of space used for each dir... possible? Tks. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
space of single dir on a server dir
I modified urkec code to get all sub-directories. I put On Error statements
in the code because the program stops when you don't have permission to get some directories. Yu may want to modify the code to let you know when permission was denied. Dim RowNumber Sub GetFolderSize() strFolder = "C:" RowNumber = 1 Set fso = CreateObject _ ("Scripting.FileSystemObject") Set folder = _ fso.GetFolder(strFolder) Sheets(1).Cells(RowNumber, 1) = strFolder + "\" Sheets(1).Cells(RowNumber, 2) = folder.Size RowNumber = RowNumber + RowNumber Call GetSubFolderSize(strFolder + "\") End Sub Sub GetSubFolderSize(strFolder) Set fso = CreateObject _ ("Scripting.FileSystemObject") Set folder = _ fso.GetFolder(strFolder) If folder.subfolders.Count 0 Then For Each sf In folder.subfolders On Error GoTo 100 Call GetSubFolderSize(strFolder + sf.Name + "\") 100 Next sf End If 'folder size in bytes On Error GoTo 200 If Not folder.isrootfolder Then FolderSize = folder.Size Sheets(1).Cells(RowNumber, 2) = FolderSize Sheets(1).Cells(RowNumber, 1) = strFolder RowNumber = RowNumber + 1 End If 200 On Error GoTo 0 End Sub "sal21" wrote: I have a dir on a server similar: \\gcd01f4500\public\user\ in this dir are presents many other dirs is possible to know for each dir in the dir USER the dimension of space used for each dir and store the value of space used in a column of Excel sheet? Note: more dir in USER are are loked but i dont want to navigate in this dir but only to know the dimension of space used for each dir... possible? Tks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
single space | New Users to Excel | |||
removing a single space in a cell | Excel Discussion (Misc queries) | |||
RTD server architecture - single topic update | Excel Programming | |||
Single Space in PRN | Excel Programming | |||
Single space? - help | Excel Programming |