FolderDelete using TERMINAL_DATA_PATH

To add comments, please log in or register
syrvn 0
134
syrvn 0  

Hi,

I try to delete, for instance, the file Folder as follows:


working_folder=TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL5\\Files"; 

FolderDelete(working_folder);


Print out returns the following string:

C:\Users\wolfg\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\MQL5\Files

Why the hell is MQL5 adding this Agent- thing after the SandBox ID?

Agent-127.0.0.1-3000
whroeder1
17943
whroeder1  
  1. working_folder=TerminalInfoString(TERMINAL_DATA_PATH)+"\\MQL5\\Files"; 
    FolderDelete(working_folder);
    For security reasons, work with files is strictly controlled in the MQL5 language. Files with which file operations are conducted using MQL5 means cannot be outside the file sandbox.
               File Functions - Reference on algorithmic/automated trading language for MetaTrader 5
    The file function only work in the sandbox (MQL5\Files or Tester\Files) You can't delete the Files folder. You can delete folders below that, but drop the working_folder.

  2. You enabled cloud computing and someone else created a file. cloud.mql5.com/
syrvn 0
134
syrvn 0  

Hi whroeder,

thanks for your comment.


I tried to delete a test Folder as well as a M.mq5 file using relativ and absolute pathes but none worked. FIleisExist always returns false. Any idea how to use relativ path to delete those two files? 


int OnInit()
  {

   FolderDelete("Files\\test");
   Print("Exists: ", FileIsExist("Files\\M.mq5"));
  
   return(INIT_SUCCEEDED);
  }


Tree

whroeder1
17943
whroeder1  
syrvn 0: I tried to delete a test Folder as well as a M.mq5 file using relativ and absolute pathes but none worked. FIleisExist always returns false. Any idea how to use relativ path to delete those two files? 
FolderDelete("Files\\test");
   Print("Exists: ", FileIsExist("Files\\M.mq5"));

What part of "but drop the working_folder." was unclear?

FolderDelete("test");
   Print("Exists: ", FileIsExist("M.mq5"));
To add comments, please log in or register