Код: Выделить всё
#!/bin/bash
deletepath="path"
donotdelete="$2"
timestamp=$(date +%Y%m%d_%H%M%S)
filename=log_$timestamp.txt
logpath="logpath.txt"
find "$deletepath" -maxdepth 5 -exec sh -c '
for dir; do
# Log the mtime and the directory name
stat -c "%y %n" "$dir" >> "$logpath"
if [ "$donotdelete" = "false" ]; then
echo "deleting files"
fi
done
' sh {} +
Код: Выделить всё
stat -c "%y %n" "$dir" >> "$logpath"
и if условие не работает и всегда печатается сообщение удаление файлов. Помощь будет очень признательна.
Подробнее здесь: https://stackoverflow.com/questions/792 ... ter-script