Here's a fast and dirty stab at the problem. Has a little treeview to show progress.
Cheers,
"Lagbolt"...That's going to be a strange name for my first-born, but I think that's what I'll call him after looking at that code
I ran it on my Desktop and it looked fantastic!
I then ran it on my share drive, and it was looking really good, right up to the point that it errored out. (not your code's fault, though...)
I found some permissions issues that caused the code to crash.
It seems that one of my in-laws, who had "Full Control" permissions to her section of the tree, (so she could set appropriate permissions for her family) went into the folder properties and removed the Admin Group from her directory structure.
This "permissions" issue tends to happen, from time to time, because each parent has a section of their shared space set aside to record a Living Will video to be played back to their spouse or family in the event they have a major illness or accident and another video in case they pass on unexpectedly...these obviously need to be secure as they are of a very personal nature, but sometimes the parents get a little too zealous in restricting access, or just goof up and set the permissions incorrectly.
In my searches, I saw saw a section of code (pasted below), that handles permissions errors.
Err_Handler:
strSQL = "INSERT INTO Files " _
& " (FName, FPath) " _
& " SELECT "" ~~~ Permissions Denied ~~~""" _
& ", """ & strFolder & """;"
CurrentDb.Execute strSQL
Resume Exit_Handler
End Function
The "permissions denied" situation is handled a bit more gracefully. Where would I insert that into the code?
Once I corrected the permissions issue, I re-ran it and received a Run-time Error 3075 Syntax Error concerning a missing Operator.
I'm pretty certain I can find it and fix it, but thought you'd want to know about it.