Pathnames passed to prename
are prepended with ./
because of -execdir
primary. So, you need to keep the first ten characters intact and substitute each dash with a space in the rest of the path string, which can be achieved fairly easily with a while loop (because g
flag doesn't work when matches overlap) and PCRE's zero-width positive lookbehind assertion thingy*.
find -name '????????*-*' -type f -execdir prename -n '1 while s/.{10,}K-/ /' {} +
This invokes prename
at least once for each directory, and thus, may be slow due to overhead from initialization. If that is a concern, you can use -exec
instead of -execdir
, and adjust the Perl expression accordingly. Below is my amateur attempt at it, use with caution.
-exec prename -n '/(.*/.{8})(.*)/; $_ = $1 . $2 =~ y/-/ /r' {} +
Drop -n
if the output looks good.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…