FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Directory function
Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM
Directory function
Posted: Thu Jul 16, 2009 08:46 PM

I need to put in a database the name of the directory of a part of the C drive .

I only need the directory and sub directory, not the files

How to ?

Thanks

Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Directory function
Posted: Thu Jul 16, 2009 10:33 PM

Hello Jack,

there is a group of filefunctions like :

cFileSubDir(), cFilePath() ...

have a look at the Help-File, if it is the solution, You are looking for.

Best Regards
Uwe :lol:

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Directory function
Posted: Thu Jul 16, 2009 11:15 PM
You can use this function to get a list of sub-folders in a folder. You can iterate to get sub-folders of these sub-folders again
Code (fw): Select all Collapse
function SubFolders( cfolder )

   local aSubFolders := {}
   local n
   local aDir        := Directory( cFolder + '\*.*', 'D' )

   for n := 1 to Len( aDir )
      if aDir[ n ][ 5 ] == 'D' .and. Left( aDir[ n ][ 1 ], 1 ) != '.'
         AAdd( aSubFolders, aDir[ n ][ 1 ] )
      endif
   next

return aSubFolders
Regards



G. N. Rao.

Hyderabad, India
Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM
Re: Directory function
Posted: Fri Jul 17, 2009 06:29 AM

Thanks for this help,
It works .

Continue the discussion