Last active
March 26, 2017 00:47
-
-
Save Blumed/d928da541eed34fc0eb88675808219f5 to your computer and use it in GitHub Desktop.
A bash function that takes file extensions as arguments. You may pass as many as you want and output each file name matching your extension into a file so you can copy and past from it quickly or share your custom file list
This file contains 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
filelist() { | |
if [ $# -gt 0 ]; then | |
shopt -s nullglob | |
for ext in "$@"; do | |
printf '%s\n' *.$ext | |
done | pbcopy | |
echo "copied listing for $@ files to clipboard" | |
else | |
shopt -s nullglob | |
for ext in *.*; do | |
echo "$ext" | |
done | pbcopy | |
echo "copied listing for all files to clipboard" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment