Search code examples
filemql4mt4

Delete a file inside a folder on Common Metatrader Folder with MQL4


I have an EA that accesses a file inside a folder called "MyFolder" in FILE_COMMON folder (\Terminal\Common\Files) and extracts information from it.

Then I simply want to delete that file.

I tried this and many other combinations without success:

FileDelete("\\MyFolder\\",FILE_COMMON + "FileToDelete.txt");

In sum, I want to delete this file: "...\Terminal\Common\Files\MyFolder\FileToDelete.txt"

Any ideas?

Thanks.


Solution

  • You need to place your files in Common\Files\ not directly in Common.

    If common_flag = FILE_COMMON, then the function removes the file from the shared folder for all client terminals \Terminal\Common\Files.

    I am back (I am using a timer and the market was closed so I could not test it during the weekend).

    Finally.... I guess I got confused when I read the "Common" bit... I assumed it was the "Common" folder and not "Common\Files".

    Thank you for pointing this out. I knew this could not be that difficult!

    It's now fixed and working.