Concatenate Current Date in Batch Script FTP output filename

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
stickandrock
Posts: 4
Joined: 18 Dec 2009 07:59

Concatenate Current Date in Batch Script FTP output filename

#1 Post by stickandrock » 28 Mar 2011 09:42

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

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Concatenate Current Date in Batch Script FTP output file

#2 Post by aGerman » 28 Mar 2011 14:29

!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

razeliex
Posts: 1
Joined: 06 Apr 2011 00:17

Re: Concatenate Current Date in Batch Script FTP output file

#3 Post by razeliex » 09 Apr 2011 00:18

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?
Last edited by razeliex on 10 Apr 2011 04:29, edited 1 time in total.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Concatenate Current Date in Batch Script FTP output file

#4 Post by aGerman » 09 Apr 2011 00:57

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

Post Reply