Hi Guys,
I am having the following code which search for specific filename in remote folder to download to local folder. How can i edit this to be searching for latest date file in remote folder to be downloaded.Thank you
@Echo Off
Set _FTPServerName=60.250.148.123
Set _UserName=ABC
Set _Password=1234
Set _LocalFolder=C:\Users\User\Desktop\Test
Set _RemoteFolder=/Download/NMC/
Set _Filename=alarm_20151211.rar
Set _ScriptFile=ftp1
:: Create script
>"%_ScriptFile%" Echo open %_FTPServerName%
>>"%_ScriptFile%" Echo %_UserName%
>>"%_ScriptFile%" Echo %_Password%
>>"%_ScriptFile%" Echo lcd %_LocalFolder%
>>"%_ScriptFile%" Echo cd %_RemoteFolder%
>>"%_ScriptFile%" Echo binary
>>"%_ScriptFile%" Echo get %_Filename%
::>>"%_ScriptFile%" Echo quit
:: Run script
ftp -s:"%_ScriptFile%"
Del "%_ScriptFile%"
How To download file with latest date only at remote folder
Moderator: DosItHelp
Re: How To download file with latest date only at remote folder
If the filenames contain the date then they can be made to sort by date.
Using the FTP log file is the only other way, and the actual log file of the FTP listing will show us if that can be done.
Here's some info: http://stackoverflow.com/questions/1155 ... and-window
Using the FTP log file is the only other way, and the actual log file of the FTP listing will show us if that can be done.
Here's some info: http://stackoverflow.com/questions/1155 ... and-window
Re: How To download file with latest date only at remote folder
foxidrive wrote:If the filenames contain the date then they can be made to sort by date.
Using the FTP log file is the only other way, and the actual log file of the FTP listing will show us if that can be done.
Here's some info: http://stackoverflow.com/questions/1155 ... and-window
Hi,
I dont get it. could you list the procedure here please.
thank you
Re: How To download file with latest date only at remote folder
kentck86 wrote:I dont get it. could you list the procedure here please.
This provides a listing of a folder. We need to see the same thing from the folder on your FTP server, showing the files.
Code: Select all
@echo off
set "site=ftp.microsoft.com"
(
echo.open %site%
echo.user anonymous password
echo.dir
)| ftp -n >log.txt