/build/static/layout/Breadcrumb_cap_w.png

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)

Posted by: brenthunter2005 19 years ago
Fifth Degree Brown Belt
0
[8D]

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: Naffcat 19 years ago
Senior Purple Belt
0
Many thanks
Posted by: sean_c_roberts 19 years ago
Senior Purple Belt
0
Why not use Wise's Check if File or Dir exists action?

...just use a UNC name: \\MyTargetPC\MyShare[$]\Myfile.bla
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ