Go Back   Wiki NewForum | Latest Entertainment News > Career Forum & Tips > Tech Forum & Tutorial > Oracle Database, SQL, Application, Programming


Add personality to your good old MkDir() function...


Reply
Views: 1429  
Thread Tools Rate Thread
  #1  
Old 08-20-2010, 10:41 AM
bholas bholas is offline
Award Winner
 
Join Date: Apr 2010
Posts: 4,977
Default 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.

Reply With Quote
Reply

Tags
programming tips

New topics in Oracle Database, SQL, Application, Programming





Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
WikiNewForum)