Created
December 1, 2022 05:20
-
-
Save zerorooot/87397545143849e60d94fb9373fc65eb to your computer and use it in GitHub Desktop.
format file name where there have "("
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
( | |
IFS=$'\n' | |
for q in $(ls -p| grep /) | |
do | |
cd $q | |
perl-rename 's/.*?\(//' * | |
perl-rename 's/\)//' * | |
for i in $(ls) | |
do | |
num=$(echo $i | awk '{printf("%03d\n",$0)}') | |
if [[ "$num" != "000" ]]; then | |
peff=$(echo $i | cut -d "." -f2) | |
mv -n $i $num.$peff | |
fi | |
done | |
cd .. | |
done | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment