Last active
December 11, 2015 07:59
-
-
Save maeharin/4570471 to your computer and use it in GitHub Desktop.
one liner / rename directory at current directory yyyymmdd -> yyyy_mm_dd / scan / sub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ls | ruby -nle '$_.scan(/\d{8}/) {|m| File.rename(m, m.sub(/(\d{4})(\d{2})(\d{2})/) {"#{$1}_#{$2}_#{$3}"})}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment