Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在使用 shell 脚本时犯了一个错误,我有想要恢复的备份文件。我必须恢复我的文件的代码(完美运行)是:
for f in *.html~; do mv $f ${f%\~}; done
(备份文件以 .html~ 结尾)。
如何通过文件夹递归地执行此操作?
在此先感谢您的帮助。
您也可以使用 rsync
rsync -a /path/to/backup /path/to/restored/folder
find -type f -name "*.html~" | while read f; do mv "$f" "${f%\~}" done