Skip to content

Instantly share code, notes, and snippets.

@airicbear
Created May 7, 2019 23:53
Show Gist options
  • Save airicbear/0f93e32a24e92c151da04ca605734400 to your computer and use it in GitHub Desktop.
Save airicbear/0f93e32a24e92c151da04ca605734400 to your computer and use it in GitHub Desktop.
Rename files in subdirectories to DIRECTORYNAME-SUBDIRECTORYNAME-FILENAME
for D in *; do
if [ -d "${D}" ]; then
for F in $D/*; do
mv $F ${PWD##*/}-${D##*/}-${F##*/}
done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment