Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

How do I move a file from an FTP site to a local network location?

(0) ShareShare
ReportReport
Posted on by

I'm needing to move a file from an FTP site to a local working directory for integration into Dynamics GP v10.    I believe I have my "Before Integration" script written correctly but I'm getting "Bad File Name or Number" when the integration is run.    Below is my script:

Dim pFSO
Dim sFileName
Dim sFTPUser
Dim sFTPPass
Dim sFTPServ
Dim sFTPDir

fNum=FreeFile
 
Set pFSO = CreateObject("Scripting.FileSystemObject")
sFileName = "<FileName>.csv"
sFTPUser = "UID"
sFTPPass = "PASS"
sFTPServ = "<FTP Server IP>"
sFTPDir = "/working/directory/"

sSourcePath = "ftp://" & sFTPUser & ":" & sFTPPass & "@" & sFTPServ & sFTPDir
sDestinationPath =
\\networklocation\workingfolder
 
If pFSO.FileExists (sDestinationPath & FileName) Then
    Wscript.Echo "File already exists."
Else
    pFSO.MoveFile sSourcePath & sFileName, sDestinationPath & sFileName
End If

I'm not sure what I've gotten written incorrect and would appreciate all insight into this.

Many thanks,

Sean

*This post is locked for comments

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,160 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans