Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the simply-static domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/html/wp-includes/functions.php on line 6121
shell脚本批量生成目录

shell脚本批量生成目录

需要在Linux环境中定期批量生成年月日的日期目录,这样,相关的文件可以按照日期类别放到对应的目录中
脚本如下所示:

#!/bin/bash
images_path="/usr/local/images"
TDATE=$(date -d next-day +%Y-%m-%d)
Next_DATE=$(date -d next-month +%Y-%m-%d)
i=0
until [[ $day == $Next_DATE ]]
do
        day=$(date -d "$TDATE $i days" +%Y-%m-%d)
        mkdir -p ${images_path}/$(date +"%Y")/$day/
        ((i++))
done

如果想指定创建日期目录可以如下所示:
创建2018-01-01到2018-02-15的日期目录:

#!/bin/bash
images_path=/wxdk_images
i=0
until [[ $day == "2018-02-15" ]]
do
        day=$(date -d "2018-01-01 $i days" +%Y-%m-%d)
        mkdir -p ${images_path}/$(date +"%Y")/$day/
        ((i++))
done

https://www.cnblogs.com/blogjun/articles/8251530.html