Page 1 of 1

Concatenate Current Date in Batch Script FTP output filename

Posted: 28 Mar 2011 09:42
by stickandrock
I have a batch file that I execute each day. It calls a FTP step to transfer some data from our host systems onto a local server for processing. The FTP step is utilizing a GET statement to transfer the data.

In my output file I would like to concatenate the current date to final output file name. This way it will assure that each day that this process runs the output files are name uniquely.

Current FTP GET statement....

get 'PWDOP.DMGJW.PR27DD01(-0)' "\\usgpdsm0nam02\group\OPPROCSN\Reports and Tools\CustomerShippedLines\ShippedLines.txt"

I would like the output filename to be ShippedLines-mmddccyy.txt verses the current ShippedLines.txt

Much appreciated to all the help.

Don

Re: Concatenate Current Date in Batch Script FTP output file

Posted: 28 Mar 2011 14:29
by aGerman
!k suggested a possible way some days ago.

Code: Select all

@echo off &setlocal
for /f "skip=1 delims=." %%d in ('WMIC OS Get LocalDateTime^|findstr .') do set "DT=%%d"
echo get 'PWDOP.DMGJW.PR27DD01(-0)' "\\usgpdsm0nam02\group\OPPROCSN\Reports and Tools\CustomerShippedLines\ShippedLines-%DT:~4,4%%DT:~,4%.txt"
pause

Regards
aGerman

Re: Concatenate Current Date in Batch Script FTP output file

Posted: 09 Apr 2011 00:18
by razeliex
How do i test to see if my FTP is working? I made a vsftpd server on my linux box and set up all the proper configurations and permissions for the /home/ftp directory... now i want to test it. Can i do this on my local machine?

Re: Concatenate Current Date in Batch Script FTP output file

Posted: 09 Apr 2011 00:57
by aGerman
Please open your own topic next time.

If you can address the server then you could test whether it works. Have a look at the FTP script examples.

Regards
aGerman