bash脚本问题,查找由gedit创建的mv波形符文件

发布于 2024-08-29 02:14:42 字数 265 浏览 2 评论 0原文

我使用 Linux 和 gedit,它有一个奇妙的习惯,即为我编辑的每个文件创建一个末尾带有波浪号的临时文件。

我试图使用以下命令将所有这些文件一次移动到不同的文件夹:

find . -iname “*.php~” -exec mv {} /mydir \;

但是,它现在给我语法错误,就好像它正在搜索每个文件并尝试移动文本片段一样。我只想将所有以 .php~ 结尾的文件移动到另一个目录。知道我该怎么做吗?

干杯柯

im using linux with gedit which has the wonderful habit of creating a temp file with a tilde at the end for every file I edit.

im trying to move all of these files at once to a different folder using the following:

find . -iname “*.php~” -exec mv {} /mydir \;

However, its now giving me syntax errors, as if it were searching through each file and trying to move the piece of text. I just want to move all of the files ending in .php~ to another directory. Any idea how I do that?

Cheers Ke

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

执妄 2024-09-05 02:14:42

试试这个单行:

for D in `find . -iname "*.php~"`; do mv ${D} /mydir; done

供将来参考,如果您进入“编辑”>“首选项>编辑器选项卡,有一个“保存前创建文件的备份副本”复选框,这是负责创建波形符版本的人。

Try this one-liner:

for D in `find . -iname "*.php~"`; do mv ${D} /mydir; done

For future reference, if you go into Edit > Preferences > Editor Tab, there is checkbox for "Create a backup copy of files before saving" That is the guy responsible for creating the tilde version.

感情旳空白 2024-09-05 02:14:42

GNU 查找

find . -iname "*.php~" -exec mv "{}" /mydir +;

for file in *.php~
do
 echo mv "$file" /mydir
done

GNU find

find . -iname "*.php~" -exec mv "{}" /mydir +;

or

for file in *.php~
do
 echo mv "$file" /mydir
done
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文