Link to home
Start Free TrialLog in
Avatar of nzfire
nzfire

asked on

FTp Scripts and UNC paths

Hi I am running a process over the next 30 days where I want to push files from a network location (hopefully just using its UNC path) to an ftp location.  I am using a vbs to start the ftp script.  I have been unable to set the lcd in the ftp script to the desired unc path so as a work around I am mapping a drive i the vbscript, running the ftp, and then removing the mapped drive.

Because of the time delays of ftping the files I have added (I know a pretty ugly one) a loop for the delay before the drive is diconnected.  I would prefer to just be able to set the lcd to the unc share.  Is this possible?

Here is my filename.ftp
---------------------------------------------------------------------
echo on
open ftplocation
usernamehere
passwordhere
cd /remoted directory/
lcd t:\
mput *.*
close
quit
---------------------------------------------------------------------

here is my vbscript file:
---------------------------------------------------------------------
' set the ftp filename
strFTPScript = "filename.ftp"
'map the network path
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "T:", "\\svnw1\GuyFawkes$"
'run the ftp script
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run ("ftp -i -s:" & chr(34) & strFTPScript & chr(34))
Set objShell = Nothing
' do a loop for a time delay
For i = 1 to 20000000
Next
'disconnect the network drive and cleanup
objNetwork.RemoveNetworkDrive "T:"
set objNetwork = Nothing
---------------------------------------------------------------------


Is there a better way to do this? Cheers

I was hoping top be able to do something like............

Here is my filename.ftp
---------------------------------------------------------------------
echo on
open ftplocation
usernamehere
passwordhere
cd /remoted directory/
lcd \\server\sharename$
mput *.*
close
quit

is my issue with the fact that it is a hidden share?
SOLUTION
Avatar of LindyMoff
LindyMoff

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial