Check if a file exists on remote machine
Where can I find a VB script to check if a file exists on a remote machine, I check the MS script center but it's a bit of a maze these days.
0 Comments
[ + ] Show comments
Answers (3)
Please log in to answer
Posted by:
brenthunter2005
19 years ago
[8D]
The easiest way is to use the FileExists method of the FileSystemObject object:
The easiest way is to use the FileExists method of the FileSystemObject object:
strComputer = "mypc001"
strDrive = "C"
strPathAndFile = "\windows\system32\shell32.dll"
Set objFSO = CreateObject("Scripting.FileSystemObject")
strCompleteFile = "\\" & strComputer & "\" & strDrive & "$" & strPathAndFile
wscript.echo "Looking for the following file: " & VBCRLF & strCompleteFile
If objFSO.FileExists(strCompleteFile) Then
msgbox "The below file does exist:" & VBCRLF & strCompleteFile
Else
msgbox "The file does not exist: " & VBCRLF & strCompleteFile
End If
Posted by:
sean_c_roberts
19 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.