Home  >  Q&A  >  body text

linux 如何批量解压rar到单独目录

我现在想实现的是批量解压目录下的所有rar文件到与其文件名相同的目录下,请问怎么做呢?

rar -x *.rar 只能解压到当前目录

求解,谢谢

PHP中文网PHP中文网2765 days ago739

reply all(4)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-17 16:23:06

    According to your needs, I wrote a script, the address is: https://segmentfault.com/a/11..., you can refer to it for suggestions

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 16:23:06

    Brother, please write a script

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 16:23:06

    I specially wrote a script to handle this kind of decompression: x.hs.

    reply
    0
  • 阿神

    阿神2017-04-17 16:23:06

    I wrote this out of thin air and have not tested it.

    Not responsible for the consequences.

    for f in *.rar;do mkdir ./$f && unrar $f ./$f;done

    reply
    0
  • Cancelreply