Date in file name FTP

July 27, 2010 at 17:27:12
Specs: Windows XP
how to ftp a file with date in it's name. for ex.

filename_yyyy_mm_dd.jpg

and date is of that day. i.e. "TODAY'.


See More: Date in file name FTP

Report •


#1
July 27, 2010 at 19:03:37
Commands like this usually work. (ftp> get linux-2.2.13.tar.gz) so I don't know why a date would fail.

I support the 'Everybody Draw Mohammed Day'. A religion doesn't deny my freedom.


Report •

#2
July 28, 2010 at 10:51:55
Here is detail:

Here is the text file which I edit everyday to change it's date in file name. for ex. waperror_2010_07_28.h
After this run today, I have to change it tomorrow to waperror_2010_07_29.h before it runs.
==========Start========
username
password
prompt no
cd /
cd /root/src/gateway-1.4.3/gw
mget waperror_2010_07_28.h
bye
=====end==========

Is it possible in cmd script that open above test file and change the file name to ftp?


Report •

#3
July 29, 2010 at 04:55:34
Untested:

@ECHO OFF
SETLOCAL 

::Create Date variables
SET month=%DATE:~4,2%
SET day=%DATE:~7,2%
SET year=%DATE:~10%

::Create Daily FTP script
>  daily.wap.error ECHO username
>> daily.wap.error ECHO password
>> daily.wap.error ECHO prompt no
>> daily.wap.error ECHO cd /
>> daily.wap.error ECHO cd /root/src/gateway-1.4.3/gw
>> daily.wap.error ECHO mget waperror_%year%_%month%_%day%.h
>> daily.wap.error ECHO bye

::Execute FTP script
ftp -n -s:daily.wap.error ftp.server

EXIT /B

When your only tool is a hammer, every problem looks like a nail.


Report •

Related Solutions

#4
July 29, 2010 at 12:38:50
Worked..Awesome.

modified little bit
@ECHO OFF
SETLOCAL

::Create Date variables
SET month=%DATE:~4,2%
SET day=%DATE:~7,2%
SET year=%DATE:~10%

::Delete dirst
ERASE daily.wap.error

::Create Daily FTP script
> daily.wap.error ECHO username
>> daily.wap.error ECHO password
>> daily.wap.error ECHO prompt no
>> daily.wap.error ECHO cd /
>> daily.wap.error ECHO cd /root/src/gateway-1.4.3/gw
>> daily.wap.error ECHO mget waperror_%year%_%month%_%day%.h
>> daily.wap.error ECHO bye

::Execute FTP script
ftp -n -s:daily.wap.error ftp.server

EXIT /B

Thanks much OB.


Report •

Ask Question