Open zesty opened 1 month ago
this works on ubuntu 22.04
remove the "-n" switch in rename to actually do the renaming
side effects: clobbers any files named: 1, 2, or 3
for n in $(seq 1 3); do echo $(ls -1 | grep -P "^[0-9]{$n} " | xargs -I'{}' echo \'{}\' ) > $n; done for n in $(seq 1 3); do echo $n; ncomp=$((4 - ${n})); eval "rename -n -v 's/^([0-9]{$n}.*)/$(print "${(pl:$ncomp::0:)}")\$1/' $(cat $n)"; done rm 1 2 3
I seem to recall rename being easier than this, but I got caught up :)
Hi @zesty,
I'll take a look as soon as I can. Thank you for the code hints!
this works on ubuntu 22.04
remove the "-n" switch in rename to actually do the renaming
side effects: clobbers any files named: 1, 2, or 3
I seem to recall rename being easier than this, but I got caught up :)