({{, (RefLink[FileSystemMap, paclet:ref/FileSystemMap])[f,root]
gives an association whose keys are the names of files in root, and whose values are the results of applying f to the full names of these files. }, {, (RefLink[FileSystemMap, paclet:ref/FileSystemMap])[f,root,n]
gives a nested association in which subdirectories down to level n are represented by an association.}, {, (RefLink[FileSystemMap, paclet:ref/FileSystemMap])[f,root,{m,n}]
gives a nested association including files in subdirectories from level m down through n.}, {, (RefLink[FileSystemMap, paclet:ref/FileSystemMap])[f,root,lev,r]
combines levels to give a nested output association with r levels.}})

OpenersNotesSection(Spacer1)Details and Options

The following options can be given:

(RefLink[FileNameForms, paclet:ref/FileNameForms]) will accept any forms specification allowed in the first argument of (RefLink[FileNames, paclet:ref/FileNames]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (6)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Apply (RefLink[FileSize, paclet:ref/FileSize]) to all files contained in a directory:

FileSystemMap[FileSize,$InstallationDirectory]

Apply (RefLink[FileHash, paclet:ref/FileHash]) to all files through level 2 of the specified directory:

FileSystemMap[FileHash,$UserBaseDirectory,2]

Apply (RefLink[FileDate, paclet:ref/FileDate]) to only those files at level 2 of the specified directory:

FileSystemMap[FileDate,FileNameJoin[{$InstallationDirectory,"Documentation","English"}],{2}]

Get a flat association for the same directory:

FileSystemMap[FileDate,FileNameJoin[{$InstallationDirectory,"Documentation","English"}],{2},1]

OpenersExampleSection1(Spacer1)Options  (2)

OpenersExampleSubsection0(Spacer1)FileNameForms  (1)

By default, all files are included:

FileSystemMap[FileSize,FileNameJoin[{$InstallationDirectory,"/Documentation/English/System/ExampleData"}]]

By specifying (RefLink[FileNameForms, paclet:ref/FileNameForms])->patt, function application will be restricted to only those files that match the specified pattern:

FileSystemMap[FileSize,FileNameJoin[{$InstallationDirectory,"/Documentation/English/System/ExampleData"}],FileNameForms->"*.pdb"]

OpenersExampleSubsection1(Spacer1)MaxItems  (1)

By default, f will be applied to all files in the specified directory and subdirectories:

FileSystemMap[FileSize,FileNameJoin[{$InstallationDirectory,"SystemFiles","CharacterEncodings"}]]

By specifying (RefLink[MaxItems, paclet:ref/MaxItems]) -> n, f will be applied to at most n items within each directory:

FileSystemMap[FileSize,FileNameJoin[{$InstallationDirectory,"SystemFiles","CharacterEncodings"}],MaxItems->2]

OpenersExampleSection2(Spacer1)Possible Issues  (1)

When specifying a fixed number of association levels, empty directories will be omitted from the resulting association:

FileSystemMap[FileByteCount,$UserBaseDirectory,2]

FileSystemMap[FileByteCount,$UserBaseDirectory,2,1]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[FileSystemScan, paclet:ref/FileSystemScan])  ▪  (RefLink[FileNames, paclet:ref/FileNames])  ▪  (RefLink[Map, paclet:ref/Map])  ▪  (RefLink[MaxItems, paclet:ref/MaxItems])  ▪  (RefLink[FileNameForms, paclet:ref/FileNameForms])  ▪  (RefLink[ParallelMap, paclet:ref/ParallelMap])  ▪  (RefLink[CreateSearchIndex, paclet:ref/CreateSearchIndex])  ▪  (RefLink[CreateArchive, paclet:ref/CreateArchive])  ▪  (RefLink[ExtractArchive, paclet:ref/ExtractArchive])  ▪  (RefLink[FileConvert, paclet:ref/FileConvert])  ▪  (RefLink[FileSize, paclet:ref/FileSize])  ▪  (RefLink[DeleteDirectory, paclet:ref/DeleteDirectory])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[File Operations, paclet:guide/FileOperations])}, {▪(RefLinkPlain[Parallel Computing, paclet:guide/ParallelComputing])}, {▪(RefLinkPlain[External Operations, paclet:guide/ExternalOperations])}})}})