MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to find all folder within a specified directory?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73140] Re: How to find all folder within a specified directory?
  • From: "David Reiss" <dbreiss at gmail.com>
  • Date: Sun, 4 Feb 2007 07:45:24 -0500 (EST)
  • References: <eq1ij9$2v2$1@smc.vnet.net>

There are quite a few files in this directory, but only several are
Directories:

In[107]:=
Length[FileNames[
    "/Users/dreiss/Documents/Mathem docs/VariousPackages/
DiaryDevelopment/Diary/*" ]]

Out[107]=
172



To find the directories use Select with the pure function
FileType[#]===Directory&


In[108]:=
Select[FileNames[
    "/Users/dreiss/Documents/Mathem docs/VariousPackages/
DiaryDevelopment/Diary/*" ],FileType[#]===Directory&]



Out[108]=
{/Users/dreiss/Documents/Mathem docs/VariousPackages/DiaryDevelopment/
Diary/Documentation,/Users/dreiss/Documents/Mathem docs/
VariousPackages/DiaryDevelopment/Diary/FrontEnd,/Users/dreiss/
Documents/Mathem docs/VariousPackages/DiaryDevelopment/Diary/HTML,/
Users/dreiss/Documents/Mathem docs/VariousPackages/DiaryDevelopment/
Diary/Kernel,/Users/dreiss/Documents/Mathem docs/VariousPackages/
DiaryDevelopment/Diary/LicenseAgreement,/Users/dreiss/Documents/Mathem
docs/VariousPackages/DiaryDevelopment/Diary/PackageTemplates,/Users/
dreiss/Documents/Mathem docs/VariousPackages/DiaryDevelopment/Diary/
PasswordInstaller}

--David
http://scientificarts.com/worklife
Now at version 1.1
15 day trial version

On Feb 3, 3:54 am, tidegenera... at tom.com wrote:
> Hi;
> I know FileNames[] can find files and sub-directories within a
> specified directory, but it seems
> there is no function to just find directory-list. If there are many
> files within the specified directory but
> only a few sub-directory and I only want to find the sub-directory-
> list, this function may spend
> lots of time, in further step I still need to select out the sub-
> directory from the list, it is too time-consuming.
> who can tell me how to find the sub-directory-list quickly?
> tidegenerator




  • Prev by Date: Re: Re: Re: Remote Kernel does nothing
  • Next by Date: Re: Re: file functions & FrontEnd`FileName
  • Previous by thread: How to find all folder within a specified directory?
  • Next by thread: Re: How to find all folder within a specified directory?