script which Copy latest data from FTP srv to local srv

August 6, 2015 at 03:52:28
Specs: Windows 7
Hi Mechanix2Go
I know this thread is old but I need help.

Scenario is.

1-click on URL link (which will generate file on FTP)
2- login to FTP and from specific folder copy the latest file which generated and copy to local server in two different folders

please help me with the above scenario . am trying below script which is not working :(

explorer "ftp://username:password@109.108.XXX.XXX/orders/v9orders/
@echo off
set source="ftp://109.108.XXX.XXX/orders/v9orders/"
set target="C:\Test case2"

FOR /F "delims=" %%I IN ('DIR %source%\*.* /A:-D /O:-D /B') DO COPY %source%\"%%I" %target% & echo %%I & GOTO :END
:END
TIMEOUT 4


See More: script which Copy latest data from FTP srv to local srv

Report •


#1
August 6, 2015 at 23:24:15
I can't make the FOR ('dir...') work in XP. It reads the / as invalid switch.

=====================

M2 Get custom script or take private lessons


Report •

#2
August 7, 2015 at 01:12:24
If I ignore the FTP section just use two local drive path it works (see below) in windows pro 7. But I need to copy data from FTP so source would be FTP that is not working..

@echo off
set source="c:\Test Case1"
set target="C:\Test case2"

FOR /F "delims=" %%I IN ('DIR %source%\*.* /A:-D /O:-D /B') DO COPY %source%\"%%I" %target% & echo %%I & GOTO :END
:END
TIMEOUT 4

regards, Umer

message edited by pirachaa


Report •

#3
August 7, 2015 at 09:19:13
Just because Explorer can process FTP links (by having Internet Explorer do the work, but details), does not mean the Command Prompt can do it. Both VBScript and PowerShell can handle FTP; I suggest you switch scripting languages.

How To Ask Questions The Smart Way


Report •

Related Solutions

#4
August 7, 2015 at 21:09:42
I spent quite some time trying to get a sirted, 'bare' listing on the only unix server I have access to.

I conclude that the shell there is crippled. One strong indicator is that this don't work: [LOL]

man ls

GEE, maybe I can upload my own shell. Comments? R2? Oblio?

=====================

M2 Get custom script or take private lessons


Report •

#5
August 9, 2015 at 14:01:23
Well, either /etc/man.config is missing/corrupt, or the manual pages were never installed. That, or you're trying to use FTP to run commands from the server, which doesn't work because FTP isn't a shell.

How To Ask Questions The Smart Way


Report •

Ask Question