Last active
December 20, 2015 11:09
-
-
Save jtpaasch/6121104 to your computer and use it in GitHub Desktop.
Get all file names (just the basenames) in a directory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get all files in the folder. | |
FOLDER=/path/to/my/folder/* | |
# We'll build the list of file names here: | |
FILES=() | |
# Add just the basename of each FILE to the list of $FILES. | |
for FILE in $FOLDER | |
do | |
FILENAME=$(basename "$FILE") | |
FILES=( ${FILES[@]} $FILENAME ) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment