123.txt -> A2Z.txt
1234 -> A2Z4
1234.txt -> A2Z4.txt
Change the (final) extension of every file
ren * *.txt
a -> a.txt
b.dat -> b.txt
c.x.y -> c.x.txt
Append an extension to every file
ren * *?.bak
a -> a.bak
b.dat -> b.dat.bak
c.x.y -> c.x.y.bak
Remove any extra extension after the initial extension. Note that adequate
?
must be used to
preserve the full existing name and initial extension.
ren * ?????.?????
a -> a
a.b -> a.b
a.b.c -> a.b
part1.part2.part3 -> part1.part2
123456.123456.123456 -> 12345.12345 (note truncated name and
extension because not enough `?` were used)
Same as above, but filter out files with initial name and/or extension longer than 5 chars so that
they are not truncated. (Obviously
could add an additional
?
on either end of targetMask to
preserve names and extensions up to 6 chars long.)
ren ?????.?????.* ?????.?????
a -> a
a.b -> a.b
a.b.c -> a.b
part1.part2.part3 -> part1.part2
123456.123456.123456 (Not renamed because it doesn't
match
sourceMask)
Change characters after last
_
in name and attempt to preserve extension. (Doesn't work
properly if
_
appears in extension.)
ren *_* *_NEW.*
abcd_12345.txt -> abcd_NEW.txt
abc_newt_1.dat -> abc_newt_NEW.txt
abcdef.jpg (Not renamed because it doesn't match sourceMask)
abcd_123.a_b -> abcd_123.a_NEW (not desired,
but no simple
RENAME form will work in this case)
Any name can be broken up into components that are delimited by
.
characters may only be
appended to or deleted from the end of each component. Characters cannot be deleted from or
added to the beginning or middle of a component while preserving the remainder with wildcards.
Substitutions are allowed anywhere.
ren ??????.??????.?????? ?x.????999.*rForTheCourse
Chia sẻ với bạn bè của bạn: