Jemboy Posted September 6, 2018 Posted September 6, 2018 Hi, Ones(some times twice) a month I get an e-mail with zip file, which has price updates from a supplier. I have to upload the file to an FTP to get it processed. When uploading the file, it will get "timestamped" with the time and date at which time the file was uploaded. Normally this is fine, because I mostly upload the file the same day. Sometimes it may take 1 or 2 days before I can upload the file. For historical purpose, I would like to have the file timestamped with the original date. I have tried using: _FTP_Command ( $hFTPSession, "MFCT YYYYMMDDHHMMSS path") however this command does not work or change the timestamp as I expected. Does anyone now a way how I can change the timestamp of a FTP-file?
FrancescoDiMuro Posted September 6, 2018 Posted September 6, 2018 @Jemboy Does the function return any error? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
Jemboy Posted September 6, 2018 Author Posted September 6, 2018 Yes, the return value was: 0 and the @error was -1.
FrancescoDiMuro Posted September 6, 2018 Posted September 6, 2018 Can you please post the whole code, and, maybe, adding @error checking to the other _FTP* functions too, in order to see if there are any errors before you use this function? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
Jemboy Posted September 9, 2018 Author Posted September 9, 2018 (edited) Hi Francesco, it took me some time because I wanted to post a working testcode with a live ftp-server to trouble shoot. On the FTP server, I first tested the _FTP_Command function with some basic server functions like e.g. PWD. After getting non-error result I new suspected that my code was valid, but that the MFCT command was not working. With Google I found out, that not alll time-date FTP command work on every server, so I started checking the time command I found at:https://en.wikipedia.org/wiki/List_of_FTP_commands with some info from: https://support.solarwinds.com/Success_Center/Serv-U_Managed_File_Transfer_Serv-U_FTP_Server/Knowledgebase_Articles/MFMT_FTP_command Testing with _FTP_Command ( $Conn, "MFMT YYYYMMDDHHMMSS file") resulted into the file time and dated being changed. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <FTPEx.au3> #include <Array.au3> Local $server = "185.182.57.118" Local $username = "autoit@testweb.nl" Local $pass = "P w T e s t 2 0 1 8" Local $Open = _FTP_Open('MyFTP Control') Local $Conn = _FTP_Connect($Open, $server, $username, $pass,1) ; Get FTP files with extended data - Return files (2), $INTERNET_FLAG_NO_CACHE_WRITE (0) and date formatted: mm/dd/yyyy (0) Local $aFile = _FTP_ListToArrayEx($Conn, 2,0,0) ; change the date if WIL05016.080 in the current ftp dir, date format = YYYYMMDDHHMMSS ; see also: https://support.solarwinds.com/Success_Center/Serv-U_Managed_File_Transfer_Serv-U_FTP_Server/Knowledgebase_Articles/MFMT_FTP_command $ResrFC = _FTP_Command ( $Conn, "MFMT 20180102110101 WIL05016.080") ; use MFMT and not MFCT _ArrayDisplay ($aFile,"FTP Test") Local $Ftpc = _FTP_Close($Open) By removing the spaces between the letters in $pass, the code should be 100% working (until I disable the FTP-server). The time and date of WIL05016.080 should be 09/05/2018, but has been changed after running the code to: 01/02/2018. When uploading a file to FTP-server, it usually gets the current date and time. If some how you want to preserve e.g. the existing filedate, you might use the MFTM command after uploading files. Edited September 11, 2018 by Jemboy
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now