• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 1:15am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 1:15am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Need help with common code functions/calls list 3 replies

Please Help! No Expert Folder in MT4 Folder 12 replies

Indicators folder in MT4 is missing on Win8! Any help please? 4 replies

Need help with 10M chart - got it already but need some help! 1 reply

Metatrader doesn't load all of the indicators in folder. 5 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
Tags: Need Help with FileMove from Common Folder to Common Folder
Cancel

Need Help with FileMove from Common Folder to Common Folder

  • Post #1
  • Quote
  • First Post: Feb 11, 2015 9:54pm Feb 11, 2015 9:54pm
  •  IaMa8oY
  • | Joined Nov 2011 | Status: Member | 10 Posts
under Terminal\Common\Files\ folder
i have 2 sub-directories called 1todo and 2done
under 1todo folder i have 1.txt, 2.txt,3.txt,4.txt,5.txt
i am trying to move all the files in 1todo to 2done.
it works between local folder, and it works move from local folder to common folder
but did not work, move from common folder to common folder.
need some help, thanks.

my guess would be
FileMove(from_folder+file_name,0,to_folder+file_na me,FILE_COMMON);
the FILE_COMMON flag only subjected to the destination folder, but not the source folder, so it still check the files in local path.

I download the MQL4 File Functions (MQL4 File Functions Replacement) from Coders' Guru
MQL4 File Functions Replacement - MT4 - Metatrader 4 File Functions DLL
but the dll file doesnt include the gFileMove function.

Inserted Code
void OnTick()
  {
   //
   string filter="*";
   string from_folder = "1todo/";
   string file_name;
   long search_handle=FileFindFirst(from_folder+filter,file_name,FILE_COMMON);
   if(search_handle!=INVALID_HANDLE)
     {     
     FileIsExist(file_name);
     Print("File name is = "+file_name);
      FileFindClose(search_handle);
     }
   else
      Print("Files not found!");
   
   //Put the data into the records array
   string records[15];
   int handle=FileOpen(from_folder+file_name,FILE_CSV|FILE_WRITE|FILE_READ|FILE_COMMON,',');
   if(handle>0)
   {         
             for(int i = 0; i<ArraySize(records);i++)
               {
                  records[i]=FileReadString(handle);
                  if(FileIsLineEnding(handle) == true )
                  break;
               }               
      }
      Print("5th record is = "+records[5]);
    FileClose(handle);        
    string to_folder = "2done/";
    FileMove(from_folder+file_name,0,to_folder+file_name,FILE_COMMON);
    
}
  • Post #2
  • Quote
  • Feb 11, 2015 10:02pm Feb 11, 2015 10:02pm
  •  RedLineFred
  • Joined Sep 2012 | Status: Member | 327 Posts
I cant be sure but have you tried including the whole file path name, starting with the drive letter?

Something like: "F:\Forex\Terminal\Common\Files\1todo" rather than just the local directory name itself.
" check out The Traders Outpost "
 
 
  • Post #3
  • Quote
  • Feb 11, 2015 10:22pm Feb 11, 2015 10:22pm
  •  IaMa8oY
  • | Joined Nov 2011 | Status: Member | 10 Posts
Quoting RedLineFred
Disliked
I cant be sure but have you tried including the whole file path name, starting with the drive letter? Something like: "F:\Forex\Terminal\Common\Files\1todo" rather than just the local directory name itself.
Ignored
i tried that before, but it seems not working.
but anyway, its solved, just changed the 0 to FILE_COMMON and it works. -_-!!
Inserted Code
FileMove(from_folder+file_name,0,to_folder+file_name,FILE_COMMON);
to
Inserted Code
FileMove(from_folder+file_name,FILE_COMMON,to_folder+file_name,FILE_COMMON);
 
 
  • Post #4
  • Quote
  • Last Post: Feb 11, 2015 11:25pm Feb 11, 2015 11:25pm
  •  FerruFx
  • Joined May 2007 | Status: MT4/MT5 EAs/Indicators/Alerts coder | 6,431 Posts | Online Now
You may find some ways to do by looking at the MQL4 reference (click F1 in the MetaEditor) ...

Look at TERMINAL_DATA_PATH ... or anything related to "path" ... you should find the right way.
MT4/MT5 EAs/Indicators/Alerts coder
 
 
  • Platform Tech
  • /
  • Need Help with FileMove from Common Folder to Common Folder
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023