Search : in
By :

Copy remote file to local machine in VB

Last answer on Oct 7, 2009 1:21:44 pm BST Simmi, on Oct 7, 2009 10:44:00 am BST 
 Report this message to moderators

Hello,

Am new to VbScript, now i need to write a vbscript to copy a file from a remote(mainly non-windows) machine to my local machine at a given location.
Please can you help me with it.

Best answers for « copy remote file to local machine in VB » in :
Download Easy File Locker Show To keep your privacy and secure up your data on your machine, the best way is to hide them altogether. Easy File Locker is primarily a tool to block access, modification, reading, deleting, moving or copying your files or folders. But to make...
Delete a file locked in the memory ShowDelete a file locked in the memory You just download an object (file, folder or program) that makes your PC crash? Moreover, no anti-malware seems to solve this problem? Finally, it is impossible to move, rename and delete this...
Moving or copying a file with your right mouse button ShowMoving or copying a file with your right mouse button Command for right mouse button Create a file in the registry Set up of the file in the registry Command for right mouse button To move or copy your document and file to another...
Log in remotely with SSH (Linux) ShowLog in remotely with SSH (Linux) The commands below are relevant only if you have an existing account on the PC you want to connect and that a SSH server is installed. When using Linux the syntax is quite simple as the client part is...
Download Blue Lock PC ShowYou must do all your best to secure access to your computer. By default there is the password system to open a session under Windows. But to go farther, use this new software. Blue Lock is an application which blocks your computer by the use or not...
Download Sentry-go Quick File & Print Monitor ShowDescription The application has been designed by 3Ds (UK) Limited. So far Sentry-go Quick File & Print Monitor allows you to manage your print jobs and also monitors the changes of your files. You can check queues, change the local, remote files...
FTP protocol (File Transfer Protocol) ShowIntroduction to FTP protocol FTP protocol (File Transfer Protocol) is, as its name indicates a protocol for transferring files. The implementation of FTP dates from 1971 when a file transfer system (described in RFC141) between MIT machines...
UNIX - Files ShowIntroduction to UNIX files In UNIX systems any element is represented in the form of a file. All files are architectured around a single tree structure where the base, called the root, is written "/". File types UNIX systems define different...
Linux commands ShowTable of main Linux commands Command Description DOS equivalent ls lists the content of a directory dir cd change directory cd cd .. parent directory cd.. mkdir creates a new...

1

 LouisSteph, on Oct 7, 2009 1:21:44 pm BST
  • +1

Dear Simmi,

Below is a sample that can help you in undertaking the task:

Dim oFS : Set oFS = CreateObject( "Scripting.FileSystemObject" )
Dim sSrcDir : sSrcDir = "//server\share"
Dim sDstDir : sDstDir = oFS.GetAbsolutePathName( "your\folder" ) & "\"

WScript.Echo "sSrcDir:", sSrcDir
WScript.Echo "sDstDir:", sDstDir

If Not oFS.FolderExists( sDstDir ) Then oFS.CreateFolder sDstDir

Dim oSrcFiles : Set oSrcFiles = oFS.GetFolder( sSrcDir ).Files
Dim oFile, sFSpec
For Each oFile In oSrcFiles
WScript.Echo "Src ", oFile.Path
sFSpec = sDstDir & oFile.Name
If oFS.FileExists( sFSpec ) Then
WScript.Echo "Fnd ", sFSpec
If oFile.DateLastModified > oFS.GetFile( sFSpec ).DateLastModified Then
WScript.Echo "Cpy (D)", sFSpec
oFile.Copy sFSpec
End If
Else
WScript.Echo "Cpy (N)", sFSpec
oFile.Copy sFSpec
End If
Next

Thanks in advance.

Reply to LouisSteph