Recursively Search through Directories
FileSystemMap will normally evaluate on all files in a given directory.
show complete Wolfram Language input
In[2]:=
Length[Keys[FileSystemMap[FileByteCount, dir]]]
Out[2]=
FileNameForms allows you to select files with a specific pattern in FileSystemMap.
In[3]:=
FileSystemMap[FileByteCount, dir, FileNameForms -> "*en*"]
Out[3]=
In[4]:=
FileSystemMap[FileByteCount, dir, FileNameForms -> "*en*"];
Length[Keys[%]]
Out[4]=
Use FileSystemScan with FileNameForms to copy all documentation pages with "Date" in the title to a new directory.
show complete Wolfram Language input
In[7]:=
FileNames["*", targetDir]
Out[7]=
In[8]:=
FileSystemScan[copy, docsDir, Infinity, FileNameForms -> "*Date*.nb"]
In[9]:=
FileNames["*", targetDir]
Out[9]=
These files can also be removed using FileSystemScan.
In[10]:=
FileSystemScan[DeleteFile, targetDir]
In[11]:=
FileNames["*", targetDir]
Out[11]=