FileBrowser does what the name implies.
Enables to browse directories and to select (multiple) file respectively directory names.
The function is completely Wolfram language based and relies only on standard functions, no explicit system calls are involved.
Enables to browse directories and to select (multiple) file respectively directory names.
The function is completely Wolfram language based and relies only on standard functions, no explicit system calls are involved.
Usage
Usage
FileBrowser[InitialPath, MultiMode]InitialPath: the path to start with, if omitted the default is “.”.MultiMode: if False (default) single path selection, if True multiple paths can be selectedPops up a DialogInput showing a two column list of paths.Left column shows either 📁 indicating a directory or 📄 indicating a file.Right column shows pathnames.Clicking left side on 📁 switches to and lists the corresponding directory.Clicking left side on 📄 returns an Association of the corresponding file information.Clicking right side on a pathname, depending on MultiModeeither returns the pathname or collects it to be returned as a List with all path further selections.In MultiMode all selected paths are returned as a List when is clicked.
Examples
Examples
Please use a valid starting path.
In[]:=
FileBrowser["/home/doc"](*browsethedirectoryanallowsinglepathselection*)FileBrowser["/home/doc",True](*browsethedirectoryanallowmultiplepathselection*)
In[]:=
res=FileBrowser["C:/Users/i010041/Documents",True];Column@res
Out[]=
C:\Users\i010041\Documents\a21.svg |
C:\Users\i010041\Documents\beat_1.jpg |
Code
Code
In[]:=
FileBrowser[path_:".",multi_:False]:=DialogInput@DynamicModule{p=If[path==="",".",path],sel={},fs,fa},ColumnRow[{Panel@Dynamic@AbsoluteFileName@p,If[multi,Button["Return",DialogReturn[sel]],Nothing]},Spacer@1],PaneDynamicfs=Prepend[FileNames["*",p],".."];Gridfs//MapfWith{fName=FileNameTake@f,a=AbsoluteFileName@f},With{m=MemberQ[sel,a]},With{file=d(EventHandler[If[m,Style[d,Background->LightGreen],d],"MouseClicked":>(sel=If[multi,If[m,DeleteCases[sel,a],Append[sel,a]],DialogReturn[a]])]),info=dEventHandler[d,"MouseClicked":>DialogReturn[f//FileInformation//Association//DeleteCases[Missing[___]]]],dir=dEventHandler[d,"MouseClicked":>(p=If[f==="..",ParentDirectory@p,f])]},IfFileType@f===Directory,"📁"//dir,fName//file,"📄"//info,fName//file,ItemSize{{All,1}2,{All,2}All},Frame->All,Alignment->Left,TrackedSymbols:>{p,sel},ImageSize{Full,200},Scrollbars->{False,True}
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
FileBrowser browse, select paths. No explicit system calls involved
by Robert Nowak
Wolfram Community, STAFF PICKS, July 29, 2025
https://community.wolfram.com/groups/-/m/t/3521079
by Robert Nowak
Wolfram Community, STAFF PICKS, July 29, 2025
https://community.wolfram.com/groups/-/m/t/3521079