I thought I write a super-simple program to import all (Excel)files from a directory a user can choose>
Manipulate[
dirName = SetDirectory[DirectoryName[importOneFileName]];
dataFiles = FileNames["*.xls*", dirName]
, {{importOneFileName, "", "Load Files"}, FileNameSetter[#] &}
]
This is actually working. However, I always get an error messages regarding the SetDirectory[]
. I can, of course, write
Quiet@SetDirectory[DirectoryName[importOneFileName]]
which works. But having an error message always seems odd.
I found that others have similar problems with FileNameSetter[]
. Maybe Quiet
is the best that can be done here.
DynamicModule[{selectedDir}, Column[{FileNameSetter[Dynamic[selectedDir], "Directory"], Dynamic[FileNames["*.xlsx", selectedDir]]}]]
$\endgroup$FileNameSetter[#] &
toFileNameSetter[#, "Directory"] &
? $\endgroup$