将所有的文件除了一 [英] Move all files except one

查看:156
本文介绍了将所有的文件除了一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能将所有的文件,除了一个?我要寻找类似:

How can I move all files except one? I am looking for something like:

'mv ~/Linux/Old/!Tux.png ~/Linux/New/'

在那里我移动旧的东西新的东西,除了-folder Tux.png 。 !-sign重新presents否定。有一些工具的工作?

where I move old stuff to new stuff -folder except Tux.png. !-sign represents a negation. Is there some tool for the job?

推荐答案

把下面给你的.bashrc

Put the following to your .bashrc

shopt -s extglob

它扩展的正则表达式。
然后,您可以通过

It extends regexes. You can then move all files except one by

mv !(fileOne) ~/path/newFolder

例外相对于其他命令

请注意,在复制目录,正向闪光灯,不能在名称用作注意到线程为什么extglob除了破除外条件

cp -r !(Backups.backupdb) /home/masi/Documents/

所以 Backups.backupdb / 是否定之前错在这里,我不会在没有动,因为使用错误则风险的目录使用它的水珠与其他命令和可能其他异常。

so Backups.backupdb/ is wrong here before the negation and I would not use it neither in moving directories because of the risk of using wrongly then globs with other commands and possible other exceptions.

这篇关于将所有的文件除了一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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