Page 1 of 1
Get Date of Single File in FTP
Posted: 19 Dec 2008 07:35
by wmorais
How do I retrieve the date of a specific file in a folder on FTP?
tks
Posted: 19 Dec 2008 22:55
by DosItHelp
wmorais,
From within a FTP session type:
200 PORT command successful
150 Opening ASCII mode data connection for file list
-rw-rw---- 1 441219 15000 2850 Dec 6 03:34 index.php
226 Transfer complete
ftp: 66 bytes received in 0.05Seconds 1.40Kbytes/sec.
or
213 20081206083402
Date and time are in the number after the 213, i.e. YYYYMMDDhhmmss
DosItHelp?
Get Date of Single File in FTP
Posted: 22 Dec 2008 05:55
by wmorais
First, thanks for the reply!
I need to put it in a variable in my code, but I don't know how.
something like this:
:: BEGIN
:: ...
set dir_arq = E:\TMP_DIR
set nome_arq = myfile.txt
:: MK FTP CONNECTION FILE
echo open FTP_SERVER > ftp_cmd.txt
echo USER>> ftp_cmd.txt
echo PWD>> ftp_cmd.txt
echo cd DIR\SUB-DIR>> ftp_cmd.txt
echo ascii>> ftp_cmd.txt
echo lcd %dir_arq%>> ftp_cmd.txt
HERE: I NEED TO PUT THE MODIFICATION DATE INTO A "VARIABLE"
TO USE IT IN ANOTHER PLACE OF CODE
echo get %nome_arq%>> ftp_cmd.txt
echo disconnect>> ftp_cmd.txt
echo bye>> ftp_cmd.txt
:: FTP CONNECTION
ftp -i -v -s:ftp_cmd.txt
:: ...
:: HERE: I NEED TO USE THE "VARIABLE" ABOVE FOR A COMPARISON
:: ...
:: END
Can you help me?
tks