Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Ok, so I have a directory which contains a whole load of folders containing RAR files, which I'd like to use a script to recursively unrar.

The script I have seems to work (extracting the resulting file to the directory/folder from which it's run from), however once it's finished extracting the file - it vanishes, and moves onto the next one, which vanishes also.

Regardless, the resulting un-extracted file keeps vanishing - and I have no idea why. Doesn't matter if i'm running the script with the user michaelh, or using sudo do to it.

My thinking is this is a permissions error somewhere, but I'll be dammed if I know where. However, it might be something else too - hence the reason for asking here.

Script

for f in `find /media/michaelh/grill-g/video/to_sort -wholename *.rar`  
  do     
    rar e -inul $f 
done

Example of directory structure and permissions

michaelh@grill:/media/michaelh/grill-g/video/to_sort$ ls -als
total 421624
     8 drwxrwxrwx 132 michaelh michaelh      8192 Jul 29 10:56 .
     4 drwxrwxrwx   4 michaelh michaelh      4096 Jul 19 18:42 ..
     4 drwxrwxrwx   2 michaelh michaelh      4096 Jul 27 03:47 foldername


michaelh@grill:/media/michaelh/grill-g/video/to_sort/foldername$ ls -als
total 243556
    4 drwxrwxrwx   3 michaelh michaelh     4096 Jul 26 01:22 .
    8 drwxrwxrwx 132 michaelh michaelh     8192 Jul 29 10:58 ..
    4 -rw-rw-r--   1 michaelh michaelh     1030 Jul 26 01:22 foldername.nfo
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 01:22 foldername.r00
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 01:45 foldername.r01
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 01:38 foldername.r02
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 05:29 foldername.r03
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 01:33 foldername.r04
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 05:23 foldername.r05
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 04:50 foldername.r06
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 01:28 foldername.r07
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 01:29 foldername.r08
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 05:17 foldername.r09
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 01:28 foldername.r10
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 01:29 foldername.r11
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 01:26 foldername.r12
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 05:01 foldername.r13
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 05:12 foldername.r14
 8780 -rw-rw-r--   1 michaelh michaelh  8970889 Jul 26 01:13 foldername.r15
14672 -rw-rw-r--   1 michaelh michaelh 15000000 Jul 26 05:28 foldername.rar
    4 -rw-rw-r--   1 michaelh michaelh      969 Jul 25 22:02 foldername.sfv
share|improve this question
    
What is the result/output of rar e foldername.rar? –  Radu Rădeanu Jul 29 '13 at 5:21

1 Answer 1

up vote 0 down vote accepted

Resolved by changing the arguments being passed, as found unrar after further research is notorious for causing CRC errors on multi-part files.

for f in `find /media/michaelh/grill-g/video/to_sort -wholename *.rar`  
  do     
    rar x -kb -inul $f 
done

replacing e for x -kb overcame the CRC errors, and didn't remove the files once completed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.