Download MetaTrader 5
To add comments, please log in or register
How to launch your trading signal and become a provider
morteza shahrezaye
8
morteza shahrezaye 2014.07.02 09:56 

Hi,

 

I am using Metatrader 4 on Linux Wine. I have a file in the folder "/home/user/.wine/drive_c/Program Files (x86)/MetaTrader 4/MQL4/Files/xxx.csv"

 

I want MQL to delete this file or move the file to "/home/user/.wine/drive_c/Program Files (x86)/MetaTrader 4/MQL4/Files/OLD/xxx.csv" after reading. I have this code:


string m_filename="xxx.csv"; 

string src_path=StringConcatenate("/home/morry/.wine/drive_c/Program Files (x86)/MetaTrader 4/MQL4/Files/"+m_filename);

string dst_path=StringConcatenate("/home/morry/.wine/drive_c/Program Files (x86)/MetaTrader 4/MQL4/Files/OLD/"+m_filename);

bool moved=FileMove(src_path,0,dst_path,FILE_COMMON|FILE_REWRITE);

	if(moved)

     	{

           Print("File Moved");

        }

 

But this does not work.... How should I correct this code?

Thanks 

qjol
3243
qjol 2014.07.02 13:57  

what about

bool moved=FileMove(m_filename,0,"OLD/"+m_filename.....);
luis
23
luis 2014.07.02 19:29  
morrysa7:

Hi,

 

I am using Metatrader 4 on Linux Wine. I have a file in the folder "/home/user/.wine/drive_c/Program Files (x86)/MetaTrader 4/MQL4/Files/xxx.csv"

 

I want MQL to delete this file or move the file to "/home/user/.wine/drive_c/Program Files (x86)/MetaTrader 4/MQL4/Files/OLD/xxx.csv" after reading. I have this code:


 

But this does not work.... How should I correct this code?

Thanks 

 


1) For reference, you can not navigate to any location on the file system. MT4 has this security constrain, as stated in:  https://docs.mql4.com/files/


2) You are using a windows program (mt4) within linux. Path names are different in linux than in windows.

Your default based directory for mt4 in linux is:

"/home/user/.wine/drive_c/Program Files (x86)/MetaTrader 4/MQL4/Files"


So, if you refer to a file xxx.csv with this path:

/home/user/.wine/drive_c/Program Files (x86)/MetaTrader 4/MQL4/Files/xxx.csv

then you could use just:

string src_path = "xxx.csv"


Now, you want to refer to destination OLD/ with following path

/home/user/.wine/drive_c/Program Files (x86)/MetaTrader 4/MQL4/Files/OLD/

Then use:

string dst_path = StringConcatenate("OLD\", "xxx.csv");

with backslash. That's it.


3) You could skip constrain 1) by creating links within the default directory to the desired files. (you probably can not create a single link to a whole directory in linux, as it is not longer allowed, even for superuser, so you would have to create a link for each individual file)

/
To add comments, please log in or register