Skip to content

Instantly share code, notes, and snippets.

@reyhansofian
Created May 7, 2016 18:20
Show Gist options
  • Save reyhansofian/e07b4c1dc1e2fd0c0bf3c662e17809dd to your computer and use it in GitHub Desktop.
Save reyhansofian/e07b4c1dc1e2fd0c0bf3c662e17809dd to your computer and use it in GitHub Desktop.
Create folder based on JSX files and move JSX file to the created folder
!#/bin/bash
for file in *.jsx; do
dir=${file%.js*}
if [ -e $dir ]; then
mv "$file" "$dir"
else
mkdir -p "$dir"
mv "$file" "$dir"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment