Watch how to download trading robots for free
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
2013.03.27 14:46
2016.11.22 07:32

The script searches all text files in the terminal local folder and deletes those of them whose creation data is less than the data value on the "InpFilesDate" input parameter. The terminal local folder location can be obtained calling the TerminalInfoString() function.

PrintFormat("The path to the terminal local folder: %s\\Files\\",TerminalInfoString(TERMINAL_DATA_PATH));

Note: The script will delete all text files which were created earlier than January 1st, 2010 from the terminal local folder (the InpFilesDate parameter value is default). Thus, before launching it, make sure that you have no text files with an important information in the terminal local folder.


//--- show the window of input parameters when launching the script
#property script_show_inputs
//--- date for old files
input datetime InpFilesDate=D'2010.01.01 00:00';
//| Script program start function                                    |
void OnStart()
   string   file_name;      // variable for storing file names
   string   filter="*.txt"; // filter for searching the files
   datetime create_date;    // file creation date
   string   files[];        // list of file names
   int      def_size=25;    // array size by default
   int      size=0;         // number of files
//--- allocate memory for the array
//--- receive the search handle in the local folder's root
   long search_handle=FileFindFirst(filter,file_name);
//--- check if FileFindFirst() executed successfully
      //--- searching files in the loop
         //--- increase the array size
         //--- reset the error value
         //--- receive the file creation date
         //--- check if the file is old
            PrintFormat("%s file deleted!",file_name);
            //--- delete the old file
      //--- close the search handle
      Print("Files not found!");
//--- check what files have remained
   for(int i=0;i<size;i++)
         PrintFormat("%s file exists!",files[i]);
         PrintFormat("%s file deleted!",files[i]);

Translated from Russian by MetaQuotes Ltd.
Original code:

Demo_FileCopy Demo_FileCopy

The script demonstrates the example of using the FileCopy() function

Demo_FileFind Demo_FileFind

The script is a simple example of using the FileFindFirst(), FileFindNext() and FileFindClose() functions

The20sv0.20 The20sv0.20

The semaphore trend signal indicator

Demo_FileMove Demo_FileMove

The script demonstrates the example of using the FileMove() function