1

My filelist in work dir:

'[CASO] SHIROBAKO [01][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [02][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [03][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [04][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [06][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [07][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [08][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [09][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [10][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [11][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [12][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [13][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [14][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [15][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [16][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [17][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [18][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [19][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [20][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [21][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [22][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [23][Ma10p_1080p][x265_2flac].rar'
'[CASO] SHIROBAKO [24][Ma10p_1080p][x265_2flac].rar'
'Daisan Hikou Shoujotai.rar'
 Exodus.rar
 passwd.txt
 Scans.rar
 SPs.part1.rar
 SPs.part2.rar
 SPs.part4.rar

I try to use 7z extract above *.rar files:

7z e *.rar -oOPT -p$(cat passwd.txt) -r

but result:

7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive for archives:
1 file, 864186364 bytes (825 MiB)

Extracting archive: [CASO] SHIROBAKO [01][Ma10p_1080p][x265_2flac].rar
--
Path = [CASO] SHIROBAKO [01][Ma10p_1080p][x265_2flac].rar
Type = Rar
Physical Size = 864186364
Solid = -
Blocks = 2
Multivolume = -
Volumes = 1


No files to process
Everything is Ok

Files: 0
Size:       0
Compressed: 864186364

That seems does not work. I feel confused.

curlywei
  • 155
  • 1
    What about using find . -iname "*.rar" -exec 7z e {} -oOPT -p$(cat passwd.txt) \; ? – Michal Przybylowicz Aug 26 '19 at 14:01
  • Hi @Michal Przybylowicz : Thanks your reply. This work fine. But I also want to know why My command can't. – curlywei Aug 26 '19 at 14:12
  • I also try find . -iname "*.rar" -exec 7z x {} -oOPT -p$(cat passwd.txt) -r +, but I got the error report find: missing argument to `-exec' . Why + can't. – curlywei Aug 26 '19 at 14:16
  • You can try to use double quotes like this 7z e "*.rar" -oOPT -p$(cat passwd.txt). – Michal Przybylowicz Aug 26 '19 at 14:18
  • 1
    Hi @Michal Przybylowicz: 7z e "*.rar" -oOPT -p$(cat passwd.txt) is work fine. Could you post it to answer? Thanks! – curlywei Aug 26 '19 at 14:21
  • @MichalPrzybylowicz Yeah, for some reason, 7z doesn't look at the -p option when multiple filename arguments are given--but unlike the overwhelming majority of commands on a Unix-like system, it does its own interpretation of globs like *.rar to specify multiple files, and when run with one such argument, it does respect -p. Either single or double quotes are fine here, as both prevent the shell from expanding *.rar into multiple arguments to 7z. Since you came up with the solution, I recommend posting an answer about it, as curlywei suggested. – Eliah Kagan Aug 26 '19 at 14:24
  • Or use \*.rar also can work fine same to "*.rar" – curlywei Aug 26 '19 at 15:15
  • I have posted an answer without the -r flag since the manual says Do not use "-r" because this flag does not do what you think. Unfortunately it does not explain what it actually does. – Michal Przybylowicz Aug 26 '19 at 15:24
  • Hi @ Michal Przybylowicz: I look this manual for 7z option -r: -r: Enable recurse subdirectories.. Yes, this flag does not do what you think.. Thanks your mentions. – curlywei Aug 26 '19 at 15:29
  • Manual website: sevenzip.osdn.jp/chm/cmdline/switches/recurse.htm – curlywei Aug 26 '19 at 15:48

1 Answers1

1

You need to put double quotes around the *.rar part of the command :

7z e "*.rar" -oOPT -p$(cat passwd.txt)