Page 1 of 1

Directory function

PostPosted: Thu Jul 16, 2009 8:46 pm
by Jack
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

Re: Directory function

PostPosted: Thu Jul 16, 2009 10:33 pm
by ukoenig
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:

Re: Directory function

PostPosted: Thu Jul 16, 2009 11:15 pm
by nageswaragunupudi
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: Select all  Expand view
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

 

Re: Directory function

PostPosted: Fri Jul 17, 2009 6:29 am
by Jack
Thanks for this help,
It works .