Any function to create nested folders at one go?

Any function to create nested folders at one go?

Postby hua » Mon Aug 22, 2011 2: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
hua
 
Posts: 1060
Joined: Fri Oct 28, 2005 2:27 am

Re: Any function to create nested folders at one go?

Postby nageswaragunupudi » Mon Aug 22, 2011 11:48 am

Code: Select all  Expand view

#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
User avatar
nageswaragunupudi
 
Posts: 10335
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Any function to create nested folders at one go?

Postby hua » Mon Aug 22, 2011 12:04 pm

Thanks Rao :)
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1060
Joined: Fri Oct 28, 2005 2:27 am

Re: Any function to create nested folders at one go?

Postby FranciscoA » Mon Aug 22, 2011 6:32 pm

Hi, Rao. Can you post a sample, please?
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2132
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Any function to create nested folders at one go?

Postby FranciscoA » Mon Aug 22, 2011 9:03 pm

Rao, Please ignore the previous post. I already did it.
Thanks.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2132
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: Any function to create nested folders at one go?

Postby Otto » Mon Aug 22, 2011 9:26 pm

Would you be so kind to post the answer.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6144
Joined: Fri Oct 07, 2005 7:07 pm

Re: Any function to create nested folders at one go?

Postby FranciscoA » Tue Aug 23, 2011 4: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
User avatar
FranciscoA
 
Posts: 2132
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 13 guests