Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Folder Size
Hi Is it possible to find a folder size, and also how can I list duplicate
files into a listbox any help will be much appreciated thanks. Charles |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Folder Size
Hi ,
You can use this : Private Sub UserForm_Activate() Dim Drv As Scripting.FileSystemObject Dim Filesx As Scripting.File Dim SourceFolder As Scripting.Folder Set Drv = New Scripting.FileSystemObject Set SourceFolder = Drv.GetFolder("c:\") ' List of files in your c:\ drive For Each Filesx In SourceFolder.Files ListBox1.AddItem Filesx.Name Next Filesx ' List of sizes in your c:\ drive msg = "Used space: " & _ FormatNumber(Drv.GetDrive("c:\").TotalSize - _ Drv.GetDrive("c:\").FreeSpace, 0) msg = msg & vbCr & "Free space: " & _ FormatNumber(Drv.GetDrive("c:\").FreeSpace, 0) msg = msg & vbCr & "Capacity: " & _ FormatNumber(Drv.GetDrive("c:\").TotalSize, 0) MsgBox msg, vbInformation, "Drive c:\" End Sub but before run you have to add your VBA references with Microsoft Scripting runtime from ToolsReferences and check "Microsoft Scripting runtime" box -- Regards, Halim "vqthomf" wrote: Hi Is it possible to find a folder size, and also how can I list duplicate files into a listbox any help will be much appreciated thanks. Charles |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Folder Size
Sub FolderSize()
Dim oFSO As Object Set oFSO = CreateObject("Scripting.FileSystemobject") MsgBox Format(oFSO.getfolder("C:\myTest").Size, "#,##0 ""bytes""") Set oFSO = Nothing End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "vqthomf" wrote in message ... Hi Is it possible to find a folder size, and also how can I list duplicate files into a listbox any help will be much appreciated thanks. Charles |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Folder Size
Thanks!
Can you answer one more question for me is it possible to list up duplicate files in a userform?. "Bob Phillips" wrote: Sub FolderSize() Dim oFSO As Object Set oFSO = CreateObject("Scripting.FileSystemobject") MsgBox Format(oFSO.getfolder("C:\myTest").Size, "#,##0 ""bytes""") Set oFSO = Nothing End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "vqthomf" wrote in message ... Hi Is it possible to find a folder size, and also how can I list duplicate files into a listbox any help will be much appreciated thanks. Charles |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Folder Size
I might if I understood what you meant.
-- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "vqthomf" wrote in message ... Thanks! Can you answer one more question for me is it possible to list up duplicate files in a userform?. "Bob Phillips" wrote: Sub FolderSize() Dim oFSO As Object Set oFSO = CreateObject("Scripting.FileSystemobject") MsgBox Format(oFSO.getfolder("C:\myTest").Size, "#,##0 ""bytes""") Set oFSO = Nothing End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "vqthomf" wrote in message ... Hi Is it possible to find a folder size, and also how can I list duplicate files into a listbox any help will be much appreciated thanks. Charles |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Folder Size
I have been asked to show a userform that a user can enter Drive or drive and
subfolder and list in a listbox any duplicated fils. Regards Charles "Bob Phillips" wrote: I might if I understood what you meant. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "vqthomf" wrote in message ... Thanks! Can you answer one more question for me is it possible to list up duplicate files in a userform?. "Bob Phillips" wrote: Sub FolderSize() Dim oFSO As Object Set oFSO = CreateObject("Scripting.FileSystemobject") MsgBox Format(oFSO.getfolder("C:\myTest").Size, "#,##0 ""bytes""") Set oFSO = Nothing End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "vqthomf" wrote in message ... Hi Is it possible to find a folder size, and also how can I list duplicate files into a listbox any help will be much appreciated thanks. Charles |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Folder Size
Hi,
What you mean with duplicate files? If all type of files you can use : Dim mydir mydir = Dir("C:\*.*") Do While mydir < "" ListBox1.AddItem mydir mydir = Dir Loop -- Regards, Halim "Bob Phillips" wrote: Sub FolderSize() Dim oFSO As Object Set oFSO = CreateObject("Scripting.FileSystemobject") MsgBox Format(oFSO.getfolder("C:\myTest").Size, "#,##0 ""bytes""") Set oFSO = Nothing End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "vqthomf" wrote in message ... Hi Is it possible to find a folder size, and also how can I list duplicate files into a listbox any help will be much appreciated thanks. Charles |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Folder Size
Doesn't help. What is a duplicated file, the possibilities are endless.
-- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "vqthomf" wrote in message ... I have been asked to show a userform that a user can enter Drive or drive and subfolder and list in a listbox any duplicated fils. Regards Charles "Bob Phillips" wrote: I might if I understood what you meant. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "vqthomf" wrote in message ... Thanks! Can you answer one more question for me is it possible to list up duplicate files in a userform?. "Bob Phillips" wrote: Sub FolderSize() Dim oFSO As Object Set oFSO = CreateObject("Scripting.FileSystemobject") MsgBox Format(oFSO.getfolder("C:\myTest").Size, "#,##0 ""bytes""") Set oFSO = Nothing End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "vqthomf" wrote in message ... Hi Is it possible to find a folder size, and also how can I list duplicate files into a listbox any help will be much appreciated thanks. Charles |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Folder Size
Files with the same name.
Regards Charles "Halim" wrote: Hi, What you mean with duplicate files? If all type of files you can use : Dim mydir mydir = Dir("C:\*.*") Do While mydir < "" ListBox1.AddItem mydir mydir = Dir Loop -- Regards, Halim "Bob Phillips" wrote: Sub FolderSize() Dim oFSO As Object Set oFSO = CreateObject("Scripting.FileSystemobject") MsgBox Format(oFSO.getfolder("C:\myTest").Size, "#,##0 ""bytes""") Set oFSO = Nothing End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "vqthomf" wrote in message ... Hi Is it possible to find a folder size, and also how can I list duplicate files into a listbox any help will be much appreciated thanks. Charles |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Folder Size
You mean search the entire drive+root folder or sub folders for files that
have exactly the same name and extension ? NickHK "vqthomf" ... Files with the same name. Regards Charles "Halim" wrote: Hi, What you mean with duplicate files? If all type of files you can use : Dim mydir mydir = Dir("C:\*.*") Do While mydir < "" ListBox1.AddItem mydir mydir = Dir Loop -- Regards, Halim "Bob Phillips" wrote: Sub FolderSize() Dim oFSO As Object Set oFSO = CreateObject("Scripting.FileSystemobject") MsgBox Format(oFSO.getfolder("C:\myTest").Size, "#,##0 ""bytes""") Set oFSO = Nothing End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "vqthomf" wrote in message ... Hi Is it possible to find a folder size, and also how can I list duplicate files into a listbox any help will be much appreciated thanks. Charles |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
Find Folder Size
I would like to give the user a choice of either if possible.
Regards Charles "NickHK" wrote: You mean search the entire drive+root folder or sub folders for files that have exactly the same name and extension ? NickHK "vqthomf" ... Files with the same name. Regards Charles "Halim" wrote: Hi, What you mean with duplicate files? If all type of files you can use : Dim mydir mydir = Dir("C:\*.*") Do While mydir < "" ListBox1.AddItem mydir mydir = Dir Loop -- Regards, Halim "Bob Phillips" wrote: Sub FolderSize() Dim oFSO As Object Set oFSO = CreateObject("Scripting.FileSystemobject") MsgBox Format(oFSO.getfolder("C:\myTest").Size, "#,##0 ""bytes""") Set oFSO = Nothing End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "vqthomf" wrote in message ... Hi Is it possible to find a folder size, and also how can I list duplicate files into a listbox any help will be much appreciated thanks. Charles |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Folder Size/File Count | Excel Programming | |||
Getting number of files within a sub-folder and its size | Excel Programming | |||
I deleted 99% of data from excel file. Folder Size remains unchang | Excel Discussion (Misc queries) | |||
Folder Size | Excel Programming | |||
How to find out the size of a variable-size array ? | Excel Programming |