bash脚本问题,找到由gedit创建的mv波形文件 [英] bash script problem, find , mv tilde files created by gedit

查看:153
本文介绍了bash脚本问题,找到由gedit创建的mv波形文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



im试图移动所有的文件这些文件一次到一个不同的文件夹使用以下内容:

  find。 -iname* .php〜-exec mv {} / mydir \; 

但是,它现在给我的语法错误,好像是通过搜索每个文件并试图移动这段文字。我只想将所有以.php结尾的文件移动到另一个目录。任何想法,我怎么做?



干杯克

解决方案

这一行:

  for D in`find。 -iname* .php〜`;做mv $ {D} / mydir;完成

为了将来的参考,如果进入编辑>首选项>编辑器选项卡,在保存之前创建文件的备份副本这是负责创建代字号版本的人。

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

解决方案

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.

这篇关于bash脚本问题,找到由gedit创建的mv波形文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆