Skip to content

Instantly share code, notes, and snippets.

@ecelis
Created October 2, 2016 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ecelis/30cf5dc69e0ef1d9443aab80047194ae to your computer and use it in GitHub Desktop.
Save ecelis/30cf5dc69e0ef1d9443aab80047194ae to your computer and use it in GitHub Desktop.
Shell oneliners
## Copy files in YYYY/MM/DD/filename.txt directory hierarchy to YYYY-MM-DD-filename.txt
find . -name '*.txt' -exec bash -c 'name="{}"; cp "${name}" ./"${name:2:4}"-"${name:7:2}"-"${name:10:2}"-"${name:13}"' \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment