Reputation: 15925
I have the following which works fine:
Function DirSearch(ByVal sDir As String) As String
For Each d As String In Directory.GetDirectories(sDir)
For Each f As String In Directory.GetFiles(d)
objSQLStringBuilder.Append("insert into table1 (full_path, file_name) values ('" & "file:///" + f.Replace("'", "''").Replace(" ", "%20").Replace("\", "/") & "', '" & f.Remove(0, Len(d) + 1).Replace("'", "''") & "');")
Next
DirSearch(d)
Next
Return objSQLStringBuilder.ToString
End Function
How would I go about changing this to work with UNC's instead of local directory mappings?
For example, at the moment if I set sDir
to C:\
, the code works fine. What changed do I need to make so it works with something \\server\c$\
instead?
Upvotes: 0
Views: 92
Reputation: 1182
ok so you know to return the path
of shared folder
dim myLocalpath as string = "c:\"
dim mysharedpath as string = "\\" & Environment.MachineName & "\" & myLocalpath
Consloe.Writeline(mysharedpath)
Output:
\\server\c:\
Upvotes: 1