Recursive file and folder audit...
Posted on 2014-11-28
A few years ago, Rey Obrero (Microsoft Access MVP) gave me a solution for this question. But now, I am not able to locate it. Suppose I specify a drive name or a folder name like:
AuditFiles("c:") or Audit("C:\MyData")
Staying with drive example for now, if we have the following files and folders:
c.xls <-- this file is in Folder_1
There could be many levels of subfolders. I am trying to read file names and folder names to enter in tblFIleAndFolders like:
ID_PK Name ID_FK FileYN
1 C: null
2 Folder_1 1 <-- meaning it is in C:
3 c.xls 2 Yes
4 FolderA 2
5 a.xls 4 Yes
6 b.xls 4 Yes
7 Folder_2 1
8 d.xls 7 Yes
9 e.xls 7 Yes
Question: Could this be done recursively to include all .xls files, folders, and subfolders (regardless it has .xls or not)?
Order of entries is not important. I will, at some point, expand this to include .doc, .png, etc.