In my EOD auto-trading, I generally use CSV files written to my hard drive to store information about any trades I am in. I use Amibroker File Input/Output functions such as fmkdir
and frmdir
to create directories and write csv files in them. When the trade is exited, I use fdelete
to first delete all files in the directory, then to delete the directory itself. May not be the best way to do things, but that was how I started.
It has worked for years, without too many problems. However, I'm now having a problem where the files are deleted fine but the folder/directory just won't delete. I can delete the directory fine manually in Windows Explorer, by selecting it and pressing delete, but using AB frmdir
does not delete it. I confirm in Windows Explorer it is empty and there are no files in it. I'm wondering if anyone can offer some advice to point me in the right direction to troubleshoot. These are things I have already done:
-
Since this problem happened at exactly the same time I updated from Google Backup & Sync to Google Drive (and this directory is in my Google Drive directory on my hard drive), I turn off the Sync for the entire folder. Still cannot delete directory using
frmdir
. -
Added a statement
_TRACE( "Directory removed status is: " + NumToStr( remove_dir ) );
to attempt to troubleshoot, but it just gives me a 0 telling me directory not deleted, but I'm not sure if that adds any useful information since I know the directory is not deleting. -
Built a testing code:
create_dir = fmkdir( "D:\\Libraries\\Google Drive\\Trading Data\\Test" );
_TRACE( "Directory created status is: " + NumToStr( create_dir ) );
remove_dir = frmdir( "D:\\Libraries\\Google Drive\\Trading Data\\Test" );
_TRACE( "Directory removed status is: " + NumToStr( remove_dir ) );
Which creates the directory fine and deletes it fine. So within the same folder (that used to be on Google Drive sync - but has the Sync turned off now), using AB Input/Output functions, I can create the directory and then remove it, but I don't seem to be able to delete directories already there.
I'd greatly appreciate if anyone has any ideas on what might be causing my inability to delete, or could point me in the right direction of how I could troubleshoot further?
Thanks.