Skip to content

Instantly share code, notes, and snippets.

@fstamour
Created June 18, 2013 16:43
Show Gist options
  • Select an option

  • Save fstamour/5807070 to your computer and use it in GitHub Desktop.

Select an option

Save fstamour/5807070 to your computer and use it in GitHub Desktop.
Shell snippet to get a file list into an array.
#From http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html
# save and change IFS
OLDIFS=$IFS
IFS=$'\n'
# read all file name into an array
fileArray=($(find $DIR -type f))
# restore it
IFS=$OLDIFS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment