Skip to content

Instantly share code, notes, and snippets.

@piaoger
Last active August 16, 2016 03:19
Show Gist options
  • Save piaoger/f4d6f6fac2d38557511bb4f70564421e to your computer and use it in GitHub Desktop.
Save piaoger/f4d6f6fac2d38557511bb4f70564421e to your computer and use it in GitHub Desktop.
list *.js files and child directories
# list *.js files in directory
for file in ./*.js
do
if [[ -f $file ]]; then
echo $file
fi
done
# list child dirs except hidden ones
dirs=$(find . -mindepth 1 -maxdepth 1 -type d \( ! -iname ".*" \) | sed 's|^\./||g')
for dir in $dirs
do
if [[ -d $dir ]]; then
#copy stuff ....
echo $dir
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment