Take a look to
rename and
perlrun (-n -l -e) (update: and
perlretut).
An adhoc one-liner can do the job.
Try this...
ls | perl -nle '$a=$_;s/.*?(S\d\dE\d\d).*?\.(avi|srt)/LikeABoss${1}Yea
+h.$2/;print "$a => $_"'
... then if everything seems OK (no files with the same "SxxEyy" for example)
ls | perl -nle '$a=$_;s/.*?(S\d\dE\d\d).*?\.(avi|srt)/LikeABoss${1}Yea
+h.$2/;rename $a,$_'
But don't feel to confident with this : it is a good idea to write a real script if you want to automate this task without human-control.
Not my fault if you lose all your pictures/movies/files.
Update:
Add this check.
Count file before renaming:
ls | wc -l
Number of file that should results:
ls | perl -nle '$a=$_;s/.*?(S\d\dE\d\d).*?\.(avi|srt)/LikeABoss${1}Yea
+h.$2/;$h{$_}++}{print scalar keys%h'
This way you can't lose the files, only the filenames ;-)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.