linux - 将 find & exec 的输出重定向到日志文件
问题描述
我根据以下参考创建了一个用于移动文件的脚本。我正在尝试捕获从源移动到目标的所有文件活动以及任何不成功的文件。 我尝试将输出输出到日志文件,但操作后日志文件大小为 0。请问有什么建议吗?
下面是代码块
destination=$(cd -- "$destination" && pwd)
cd -- "$source" &&
find . -type f -newermt $startdays -not -newermt $enddays -exec sh -c '
for x do
mkdir -p "$0/${x%/*}"
mv "$x" "$0/$x"
done
' "$destination" {} + >> output.log
解决方案
默认情况下,mv
不产生任何输出。如果您希望它产生输出,请尝试mv -v
.
推荐阅读
- regex - 使用正则表达式确定这两种情况
- typescript - “”的这种行为是 TypeScript 类型系统错误吗?
- physics-engine - PAL(物理抽象层)仍然是一个可行的实用程序吗?
- docker - GitHub Actions:获取所有作业命令以在 Docker 容器中运行
- python - 如何在 Keras 中的 layers.concatenate() 之后规范化数据输入
- c++ - 特征实例作为不同特征的模板参数
- git - Git在两个存储库中同步两个称为“生产”的分支
- azure - 如何将变量传递给 Azure Marketplace VM 报价
- android - 将 layout_constraintWidth_default 与 spread 或 wrap 一起使用没有区别吗?
- vb.net - 将 CheckedListBox 中的选择更改为用户类型