aurumdigitus wrote:Is there a way using Rename Special
to truncate the first or last X characters of the base of a file name(s)?
Failing that is there an alternative method within XY?
Rename Special > RegEx Rename
to truncate the first X characters of the base of a file name
use
.{amount}(.+) > $1
like e.g.
.{6}(.+) > $1
Explanation:
. >>> match any sign
{amount} >>> match that amount of the last regex (the dot here)
(.+) >>> match one-or-more of any sign and group this for an backreference use with $1
-- -- --
Rename Special > RegEx Rename
to truncate the last X characters of the base of a file name looks a bit more tricky
use
(.+).{amount}\.(.+) > $1.$2
like e.g.
(.+).{3}\.(.+) > $1.$2
Explanation:
(.+).{3} >>> like above, match one-or-more of any sign, followed by n amount of any sign
\. >>> till an real dot, followed by
(.+) >>> the extension
Here we have two backreferencing groups to use in the replacement as $1 dot $2
BTW, such back references are also useful to swap name part.
HTH in some way ?
