linux下安装递归删除文件,Linux下递归删除文件

在用Beyond

Compare比较Ducati两个版本,发现一个版本有很多build时生成的中间文件:.xdcenv.mak

影响视觉,反正没用,还是删掉好!

对于Linux下的各种命令,还不是很熟悉!慢慢来吧!

递归删除目录下的文件

$ find ./  -name

.xdcenv.mak  |

xargs  rm –rvf

xargs第一次碰到,找了下帮助看看,介绍如下:

主要作用就是执行命令,这些命令可以带一些初始的参数,但其他的参数却可以从standard

input读取,而不是直接指定!通常这些参数是一个很长的文件列表(比如由ls或者find产生的输出)

xargs

xargs [options] [command]

Execute command (with any initial

arguments), but read remaining arguments from standard input

instead of specifying them directly. xargs passes these

arguments in several bundles to command, allowing

command to process more arguments than it could normally

handle at once. The arguments are typically a long list of

filenames (generated by ls or find, for example) that

get passed to xargs via a pipe.

Options

-0, --null

Expect filenames to be terminated by NULL instead

of whitespace. Do not treat quotes or backslashes specially.

-e[string] , -E

[string] , --eof[=string]

Set EOF to _ or, if specified, to

string.

--help

Print a summary of the options to xargs and

then exit.

-i[string] , -I

[string] , --replace[=string]

Replace all occurrences of { }, or string,

with the names read from standard input. Unquoted blanks are not

considered argument terminators. Implies -x and -L

1.

-l[lines] , -L [lines]

, --max-lines[=lines]

Allow no more than lines nonblank input

lines on the command line (default is 1). Implies -x.

-n args,

--max-args=args

Allow no more than args arguments on the

command line. Overridden by the maximum number of characters set

with -s.

-p, --interactive

Prompt for confirmation before running each command

line. Implies -t.

-P max,

--max-procs=max

Allow no more than max processes to run at

once. The default is 1. A maximum of 0 allows as many as possible

to run at once.

-r, --no-run-if-empty

Do not run command if standard input contains only

blanks.

-s max,

--max-chars=max

Allow no more than max characters per

command line.

-t, --verbose

Verbose mode. Print command line on standard error

before executing.

-x, --exit

If the maximum size (as specified by -s) is

exceeded, exit.

--version

Print the version number of xargs and then

exit.

Examples

grep for pattern in all files on the

system:

find / | xargs grep pattern

> out &

Run diff on file pairs (e.g., f1.a

and f1.b, f2.a and f2.b, etc.):

echo $* | xargs -n2

diff

The previous line would be invoked as a shell

script, specifying filenames as arguments. Display file, one

word per line (same as deroff -w):

cat file | xargs -n1

Move files in olddir to newdir,

showing each command:

ls olddir | xargs -i -t mv olddir/{ } newdir/{ }

另一种方法:

find ./ -name ".xdcenv.mak" -exec rm -rvf "{}"

\;

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值