简体   繁体   English

使用 xargs 解压多个文件

[英]using xargs to unzip multiple files

I'm trying to unrar a tonne of files in a directory using xargs...我正在尝试使用 xargs 解压缩目录中的大量文件...

having little luck with this command:这个命令运气不好:

find /home/jchristian/bfdata/2014/*.rar -print0 | xargs -0r unrar x

gives the following output:给出以下输出:

UNRAR 5.00 beta 3 freeware      Copyright (c) 1993-2013 Alexander Roshal
Extracting from /home/jchristian/bfdata/2014/bfinf_horse_140106to140112_140115120001.rar

No files to extract

Yes, When I run unrar with that file outputted above - It extracts gracefully...是的,当我使用上面输出的文件运行 unrar 时 - 它优雅地提取......

unrar x     /home/jchristian/bfdata/2014/bfinf_horse_140106to140112_140115120001.rar

UNRAR 5.00 beta 3 freeware      Copyright (c) 1993-2013 Alexander Roshal


Extracting from   /home/jchristian/bfdata/2014/bfinf_horse_140106to140112_140115120001.rar

Extracting  bfinf_horse_140106to140112_140115120001.csv               OK 
All OK

Any ideas?有任何想法吗?

this should work这应该有效

find /home/jchristian/bfdata/2014/ -name *.rar | xargs -n 1 unrar x

find need a path and an expression, so find需要一个路径一个表达式,所以

find /home/jchristian/bfdata/2014/*.rar -print0

will return nothing不会返回任何东西

You could skip the xargs step by using find -exec您可以使用find -exec跳过 xargs 步骤

find /home/jchristian/bfdata/2014 -name \*.rar -exec unrar x {} \;

You need e or x after unrar解压后需要 e 或 x

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM