As far as I know, find . -maxdepth 1 -type f
is the only reliable way to get the list of files in a folder. However, naively putting the output of this command in a bash array (($(find . -maxdepth 1 -type f)
) is going to fail if some files have spaces in their names.
What is the correct way to do this?