Can a file that exists outside of the MetaTrader folders be opened? - MQL4 programming forum #1-#3 (2020)
Hi
thanks for the feedback , i just tried your suggestion
static bool mfs_CopyFolder3(string in_srcPath, string in_tgtPath) { bool res = CopyFileW(in_srcPath, in_tgtPath, false); M_LOG_ERROR( M_C_StrgMgrSvc_T, (!res), N_LGR::E_LG_LVL::e_info, ("filecopy for " + typename(T_StrgClient) + "WinErr= " + IntegerToString(RtlGetLastWin32Error()) ) ); return res; }
I was getting windows error code 5 = access denied. The test was on random folders copy from c drive to d drive on my pc.
I am trying to copy entire folders from anywhere to anywhere, any tips much appreciated. This is code i want to use to update my VPS to save me some maintenance headache.
Cheers
#include <fxsaber\MultiTester\MTTester.mqh> // https://www.mql5.com/ru/code/26132 void OnStart() { const string FileNameIn = MQLInfoString(MQL_PROGRAM_PATH); const string FileNameOut = "C:\\Example.ex5"; MTTESTER::FileCopy(FileNameIn, FileNameOut); }
Just a bit more info in case it helps.
the folders to and from for my test are
string lc_to = "D:\\Development\\Projects\\MQL5\\TestData\\ProfileTest"; string lc_from2 = "D:\\Development\\Projects\\MQL5\\TestData\\temp\\*.*"; static bool mfs_CopyFolder4(string in_fromPath, string in_toPath) { bool res = MTTESTER::FileCopy(in_fromPath, in_toPath); M_LOG_ERROR( M_C_StrgMgrSvc_T, (!res), N_LGR::E_LG_LVL::e_info, ("filecopy for " + typename(T_StrgClient) + "WinErr= " + IntegerToString(RtlGetLastWin32Error()) ) ); return res; }
I get windows error code 123 for invalid name, other times i get error code 5 for access denied.
Any help much appreciated.
If i have to i will write console app to move files around, but for now am trying to move files around from inside the EA for my vps update.
cheers

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
i am trying to write some code to allow me to copy files from my mql profile area into anywhere like say local pc or pc on local network.
I have tried some code with diffrent results.
Any tips much appreciated. Since i want to copy outside of mt5, i cannot use mql file api.
Cheers