Skip to content

Instantly share code, notes, and snippets.

@ecelis

ecelis/onliners.sh

Created Oct 2, 2016
Embed
What would you like to do?
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