I needed to remove parts of file-names with broken encoding from directory structure.
Example of the name with bad encoding:
SnÃmka000.jpg
Requested output example:
000.jpg
I used program find to dump directory tree chained with program rename to do bulk renaming via regular expressions. Here is how it looks like:
find . | rename 's/([^(\/Sn)]*)\/Sn([^0-9]*)([0-9]*\.jpg)$/$1\/$3/'
To check the results before proper execution, you can use flag "-n":
find . | rename -n 's/([^(\/Sn)]*)\/Sn([^0-9]*)([0-9]*\.jpg)$/$1\/$3/'
More info:
man rename
man find
By default, I will not analyze chained command here, but I will answer your questions, if case of need in place.
sobota 19. júna 2010
Prihlásiť na odber:
Príspevky (Atom)