How do I retrieve the date of a specific file in a folder on FTP?
tks
Get Date of Single File in FTP
Moderator: DosItHelp
wmorais,
From within a FTP session type:
or
Date and time are in the number after the 213, i.e. YYYYMMDDhhmmss
DosItHelp?
From within a FTP session type:
Code: Select all
ftp> dir index.php
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
Code: Select all
ftp> quote mdtm index.php
213 20081206083402
Date and time are in the number after the 213, i.e. YYYYMMDDhhmmss
DosItHelp?
Get Date of Single File in FTP
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
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