I need to perform a series of actions initiated by passing a string, with the course of actions depending on whether the string is a file, folder or web address.
FYI - for a file, I copy the file to the repository, for the folder I make the .lnk shortcut and copy it to the repository, and for the web url I make the .url shortcut and copy its storage.
I developed a solution, but it is not stable enough; I get a random error from incorrect string identification. The method I used consisted of counting points in a row and applying the rule:
If Dots = 1 Then... it a file. If Dots < 1 Then... it a folder. If Dots > 1 Then... it a website.
Then I improved it using a couple of functions that I found on the Internet:
Dots = Len(TargetPath) - Len(Replace(TargetPath, ".", "")) ' Crude check for IsURL (by counting Dots) If CheckFileExists(TargetPath) = True Then Dots = 1 ' Better check for IsFile If CheckFolderExists(TargetPath) = True Then Dots = 0 ' Better check for IsFolder
The problem is that I am still having problems with two circumstances:
When file names contain additional periods, for example. \Report.01.doc
When the line is a file or folder in a remote location on the intranet (I think it might be incorrectly identified as a web url).
Any pointers in the right direction would be highly appreciated.
Tom x
source share