开发者

Extracting RAR archive into multiple directories on Windows

On a Windows box, I need to extract a RAR archive so that individual files in it go into specific directories. I can provide, say, a text file that lists each file and the target directory for it? Then I need help creating a batch file that will actually extract these files into their target locations.

E.g. RAR archive x.rar开发者_高级运维 contains

a.a
b.b
c.c

Text file x.txt says

a.a   C:\foo
b.b   C:\bar
c.c   C:\foo

Result of running batch file on x.rar and x.txt should be:

  • in C:\foo we have a.a and c.c
  • in C:\bar we have b.b


You can pass rar a list of file names to extract with -n@<listfile>. So if you create a single file for each directory you want to extract to this should be a viable option. However, the file you describe to have doesn't quite match the format; you'd need to group it by target directory (much more fun in PowerShell by the way).

However, if the archive you're extracting is a solid archive this will take far longer since you essentially have to decompress the whole archive over and over again.

The best and probably easiest method would then probably to extract the archive once and then sort all files in their respective directories.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜