Created
June 4, 2022 13:51
-
-
Save AkBKukU/ae72b0f8e3d60c80d857014bef81cea3 to your computer and use it in GitHub Desktop.
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 | |
counter=0 | |
files=(*) | |
count=${#files[@]} | |
dir=0 | |
for file in * | |
do | |
echo "File: `printf %03d $counter`-$file" | |
if [[ "$1" == "--apply" ]] | |
then | |
mv $file "`printf %03d $counter`-$file" | |
fi | |
if [[ "$dir" == 0 ]] | |
then | |
counter=$((counter+2)) | |
else | |
counter=$((counter-2)) | |
fi | |
if [[ "$((counter+1))" -gt "$((count))" ]] | |
then | |
counter=$((counter-1)) | |
dir=1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment