Hi everyone!
I'm facing a challenge in writing a code to create directory with SynvFile function
I would like in the directory it have been a folder named using the Date and time when the synchronization is made.
I think this was possible with de PNC file (%DateTime) so I wrote a similar code as bellow:
function SyncENQ1AvecQG()
if syncconnect(FTP,URLServer,Username,Pass) then
syncfile(PUT, "../App_Gouv/Gouvernance_MIC.csdb",
"/%Data_serveurENQ1%/%DateTime%/Gouvernance_MIC.csdb");
Buuut It doesn't work
I juste have a directory as : Data_serveurENQ1 ==> DateTime
instead of Data_serveurENQ1 ==> 060320191233 (for example)
What is wrong in my code ?
FTP: Creating a systematic directory with SyncFile function
-
- Posts: 13
- Joined: November 20th, 2016, 5:54 am
-
- Posts: 13
- Joined: November 20th, 2016, 5:54 am
Re: FTP: Creating a systematic directory with SyncFile function
Hello Everyone
We (my colleague and I) have found a way to overcome the matter.
We have first create variables to get systematically date and hour in string format using edit() and sysdate() function. After we created an alphanum variable which is the concatenation of date and time making sure that /%; %/ symbols are at their rigth places. Then we use this alphanum from the concatenation as the to_path argument in the syncfile() function.
Maybe there exist a better way to do.
Opned to any other suggestions
Thanks
We (my colleague and I) have found a way to overcome the matter.
We have first create variables to get systematically date and hour in string format using edit() and sysdate() function. After we created an alphanum variable which is the concatenation of date and time making sure that /%; %/ symbols are at their rigth places. Then we use this alphanum from the concatenation as the to_path argument in the syncfile() function.
Maybe there exist a better way to do.
Opned to any other suggestions
Thanks
Re: FTP: Creating a systematic directory with SyncFile function
Here's an example with sysdate and systime:
if syncfile(PUT, "/icon.png", edit("99999999", sysdate("YYYYDDMM")) + edit("9999", systime("HHMM")) + "/icon.png") then
However, if I just need a unique folder name, I prefer timestamp. If necessary I can always convert back to datetime:
if syncfile(PUT, "/icon.png", maketext("%d", timestamp()) + "/icon.png") then
-
- Posts: 13
- Joined: November 20th, 2016, 5:54 am
Re: FTP: Creating a systematic directory with SyncFile function
Thank very much Aaronw for the input
I will try right now
I will try right now