FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Any function to create nested folders at one go?
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Any function to create nested folders at one go?
Posted: Mon Aug 22, 2011 02:44 AM

Hi guys,
To clarify, if I need a folder called c:\my program\data\backup, the function will auto create My Program, Data and Backup as necessary.

TIA

FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Any function to create nested folders at one go?
Posted: Mon Aug 22, 2011 11:48 AM
Code (fw): Select all Collapse
#pragma BEGINDUMP

#include <shlobj.h>
#include <hbapi.h>

HB_FUNC (SHCREATEDIRECTORY)
{
   hb_retni( SHCreateDirectoryEx( NULL, hb_parc( 1 ), NULL ) );
}


#pragma ENDDUMP

In you application, use the function ShCreateDirectory( <cFullPath> )
Return value indicates success.

Link shell32.lib with application.
You may even declare this as DLL function.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: Any function to create nested folders at one go?
Posted: Mon Aug 22, 2011 12:04 PM

Thanks Rao :)

FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Any function to create nested folders at one go?
Posted: Mon Aug 22, 2011 06:32 PM

Hi, Rao. Can you post a sample, please?

Francisco J. AlegrĂ­a P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Any function to create nested folders at one go?
Posted: Mon Aug 22, 2011 09:03 PM

Rao, Please ignore the previous post. I already did it.
Thanks.

Francisco J. AlegrĂ­a P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Any function to create nested folders at one go?
Posted: Mon Aug 22, 2011 09:26 PM

Would you be so kind to post the answer.
Best regards,
Otto

Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: Any function to create nested folders at one go?
Posted: Tue Aug 23, 2011 04:30 AM

As Rao said, we must link shell32.lib with our aplication. (Shell32.Lib is in the Borland directory)
//------------------
Function Prueba()
local cDirDest := "C:\FRANCISCO\DOCUMENTOS\DIVERSOS\"

ShCreateDirectory( cDirDest )

Return Nil

pragma BEGINDUMP

include <shlobj.h>

include <hbapi.h>

HB_FUNC (SHCREATEDIRECTORY)
{
hb_retni( SHCreateDirectoryEx( NULL, hb_parc( 1 ), NULL ) );
}

pragma ENDDUMP

Saludos.

Francisco J. AlegrĂ­a P.

Chinandega, Nicaragua.



Fwxh-MySql-TMySql

Continue the discussion