各位,需要帮忙解压一大批 rar 文件。不想一个一个地解压。我在“dir”的子目录中有几个目录,每个目录中都有许多 .rar 文件。
dir
subdir_a
filename with spaces 01.rar
filename with spaces 02.rar
filename with spaces NN.rar
subdir_b
filename with spaces 01.rar
filename with spaces 02.rar
filename with spaces NN.rar
subdir_c
filename with spaces 01.rar
filename with spaces 02.rar
filename with spaces NN.rar
我想将 rar 文件解压到与当前标有 .rar 文件名的目录中相同的位置。因此,解压后subdir_a
会显示如下内容:
dir
subdir_a
filename with spaces 01
file 1.ext
file N.ext
filename with spaces 01.rar
filename with spaces 02.rar
filename with spaces 02
file 1.ext
file N.ext
filename with spaces NN.rar
filename with spaces NN
file 1.ext
file N.ext
我dir
尝试使用% find . -name '*.rar' -exec sh -c 'echo unrar e \"$1\" \"${1%.*}\" ' _ {} \;
进行echo
测试。它打印出我期望的结果:
unrar e "./subdir_a/filename with spaces 01.rar" ".subdir_a/filename with spaces 01/"
等等。但是,当我删除“echo”时,我得到了ERROR: Unknown option:
知道原因吗?或者是否有更好的方法可以解决?