Mac批量重命名图片|设置文件夹的标签

今天从朋友圈下载了一些图片,文件太多了,一个一个重命名太麻烦了,于是弄了一个 bash 的脚本,用到的软件:

  1. finder_colors: https://github.com/danthedeckie/finder_colors

脚本如下:

for j in "$@"
do
    
    echo Rename download files
    echo ...
    for file in $(ls *wx_fmt*);
    do
        ((i+=1))
        mv "$file" "$j"_$i.jpg 
    done

    if [ ! -d "$j" ]; then
        echo Creating $j Folder
        mkdir "$j"
        echo Moving files to $j folder
        mv "$j"*.jpg ./"$j"
        # https://github.com/danthedeckie/finder_colors
        # should download script from github
        # pip install finder_colors
        # chmod +x /usr/local/bin/finder_colors.py
        # following code will tag foler to red
        echo Taging $j folder to red
        finder_colors.py red "$j"
    fi
done

脚本使用:

bash WeChat.sh "George_Shiras_III"
Terminal输出
文件夹已经设置为“红色”标签

你可能感兴趣的:(Mac批量重命名图片|设置文件夹的标签)