Skip to content

Instantly share code, notes, and snippets.

@jontey
Last active February 19, 2020 07:53
Show Gist options
  • Save jontey/ed81e1c719946120169d72f14f33d04b to your computer and use it in GitHub Desktop.
Save jontey/ed81e1c719946120169d72f14f33d04b to your computer and use it in GitHub Desktop.
Increment folder name by 1
# Increment folder names from dist[i] to dist[i++]
# Delete last dist[length] folder
# curl -s https://gist.githubusercontent.com/jontey/ed81e1c719946120169d72f14f33d04b/raw/folder_plusplus.sh | sh
ls -vrl | egrep '^d' | gawk -F"dist" '{ print "mv dist" $2 " dist" $2+1}' | bash
ls -vl | egrep '^d' | tail -1 | awk '{print "rm -rf " $9}' | bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment