You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
For some reason, the operating system does not allow to delete the file - either it is opened by another program, or it is not authorised enough.
Exactly like this. When I try to delete a folder that already contains subfolders and files, I delete the files first. Only the subfolders remain. I try to clean them using FolderClean() and then call FolderDelete(). However, the result is that those subfolders that were empty are well deleted, but if there were more subfolders inside the subfolders they are not deleted. After that, I try to remove the folders from the file navigator in MetaEditor manually, but the terminal does not remove them and pops up this window:
I click on "Continue", agree to the changes, but the folder is still not erased. After completely closing and reopening the terminal, the folders that should have been erased either disappear on their own or not, but you can erase them immediately and manually without the above window.
Such oddities...
What I had to prove: old terminal DOES NOT SEE MQL5 programs. You are trying to open someone else's file sandbox in MQL5 script.
PS And in general - not to give the program logs is to force others to guess by coffee groundsTake a look at this gif:
I gave the code for this script above, on the previous page.
I should add that the folders that I'm trying to erase first software and then manually aren't open anywhere. Moreover, they cannot be opened anywhere except the file navigator itself in MetaEditor, because they are empty and the files from them were previously erased. The erased files have not been opened anywhere either.
The window asking for administrator approval to manually erase folders in the file navigator in MetaEditor only appears when trying to erase those folders that the program tried to erase using FolderClean() and FolderDelete() earlier. This window never appears when trying to delete other folders.
Why does the FolderClean() function in this script fail?
Attempting to clean a folder results in error 5026 - (folder cannot be cleaned).
This script is taken from the documentation ( FolderDelete() function section) and slightly modified. To completely delete a folder that contains other subfolders or files, you have to clear it. A call to FolderClean() is added for this purpose.
Can I ask why there is no file closure? Or am I just not seeing it?
Here's a snippet of your code from opening the file to asking for deletion...
May I ask why there is no closing of the file? Or am I just not seeing it?
Here is a snippet of your code from the opening of the file to the question about deleting...
As far as I know, if no changes have been made to the file using FileWrite(), there is no need to close it. The FileOpen() function simply creates a new file and this operation does not require closing the file. In addition, this script is taken from the documentation and I did not change anything there. I just added lines with the FolderClean() function.
But if you look through the code using the debugger, you will see that immediately after FileOpen() is executed, there is a file with null size on disk. And there are rather many errors and inaccuracies in the documentation.
But if you go through the code with the debugger, there is a zero-sized file on the disk right after FileOpen() is executed. And there are rather many errors and inaccuracies in the documentation.
So it should be zero size for this example.
Now I will try to explicitly close the file in the script and try again.
So it should be zero size for this example.
I'm going to try an explicit file close in the script and try again.
The result is the same.
Here is the new code: