Ads 468x60px

Smaller time frame always follow the bigger time frame. It's better wait be patience to enter in position than risk with BIG SL. Having strong trading discipline and taking losses when necessary is a sign of serious trading approach

Saturday, August 11, 2012

ADD PERSONALITY TO YOUR GOOD OLD MKDIR() FUNCTION...


Looking for a function that can create multiple directories (directories inside directories) using a single function call? Well, "MkDir()" function is not it, but the following function maybe just what you're looking for: 
 
program MkDirMul;

uses
  SysUtils, FileCtrl;

procedure MkDirMulti(sPath : string);
begin
  if('' = sPath[Length(sPath)])then
  begin
    sPath := Copy(sPath, 1,
                  Length(sPath)-1);
  end;

  if( ( Length( sPath ) < 3 ) or
      FileCtrl.DirectoryExists(
        sPath) )then
  begin
    Exit;
  end;

  MkDirMulti(
    SysUtils.ExtractFilePath(
      sPath ) );

  try
    System.MkDir( sPath );
  except
    { handle errors }
  end;
end;

begin
  { don't forget to provide
    a full path name }
  MkDirMulti(
    'c:temponetwothreefour' );
end.
Listing #1 : Delphi code. Download mkdirmul (0.43 KB).

comments