Code Script .co.uk

Home | Scripts | Tutorials | Disclaimer | Sitemap | Contact

   Simple File Report
 

Vbscript / Files And Folders / Simple File Report

Script to recursively scan through a folder structure and record the path of every file to an output list file.


Set objFSO = CreateObject("Scripting.FileSystemObject")


Set objShell = CreateObject ("Shell.Application")
Set objFolder = objShell.BrowseForFolder (0, "Select Target Folder", (0))

targetPath = objFolder.Items.Item.Path

logName = objFolder.Title & " Scan.tsv"

Set objLogFile = objFSO.OpenTextFile(logName, 8, True)


If targetPath = "" Then
Wscript.Quit
End If


Set objFolder = objFSO.GetFolder(targetPath)

fileScan objFolder


Sub fileScan(objFolder)

  'Loop through the files in the folder
  For Each objFile In objFolder.Files

filename = objFile.Name

objLogFile.WriteLine(objFile.Path)

Next

For Each Subfolder In objFolder.SubFolders
fileScan Subfolder
Next

End Sub

Wscript.echo "Done"






Please note that a disclaimer applies to any code on this page.

 
   Actions
  Go Back
  Bookmark
  Print Page


   Menu
 
- Links
- Reference
- Script Editors
- Tutorials
- Vbscript
     - Active Directory
     - Exchange
     - Files And Folders
          - Auto Copy Files From Cdrom
          - Backup My Documents
          - Cleanup Filenames
          - Create Remote File Share
          - File Properties
          - File Server Report
          - File Type Report Scan
          - Find And Replace Filename Text
          - Find And Replace Text In Files
          - Folder Size Scanner
          - Rename Files Find And Remove Text
          - Rename Files Find And Replace Text
          - Replace Folder Ntfs Security Permissions
          - Simple File Report
          - Sort And Move Files To Folders
          - Windows File Locations
     - General
     - Ms Office
     - Operating System
     - Processes And Services
     - Text Processing
     - User Interaction
     - Web Servers