Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
List duplicate Files in Drive
Hi
I was wondering what was the best way to run through a drive and list duplicate files into a spreadsheet. TIA Charles |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
List duplicate Files in Drive
this code will get the all files on a drive. The question is how to identify
dupicate files. Are duplicates files with same name and date? same name, date, and size. 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 "vqthomf" wrote: Hi I was wondering what was the best way to run through a drive and list duplicate files into a spreadsheet. TIA Charles |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Access to excel files not on drive C | Setting up and Configuration of Excel | |||
Excel 2007 tmp files filling up drive with XLSM files | Excel Worksheet Functions | |||
Drive Erased, got Files back but only excel files scrambled, help. | Excel Discussion (Misc queries) | |||
Drive - Folders - Files | Excel Discussion (Misc queries) | |||
Can I move files From Drive to drive using VBA | Excel Programming |