Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Unzipping and Unraring

  1. #11
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Unzipping and Unraring

    Just add a & to the end of the unzip command. The terminal output might be a bit messy, but that's what you get for impatience.

    I actually interpreted "at the same time" as with one command. If you type that loop into bash, you can sit back and watch the mayhem.

  2. #12

    Default Re: Unzipping and Unraring

    Code:

    for i in *.zip
    do
    mkdir "${i/.zip}"
    unzip -d "${i/.zip}" "$i"
    done
    What would the code be when dealing with rar files (with unrar)?

  3. #13
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Unzipping and Unraring

    Dunno, I am a bit busy right now and haven't got time to look at the unrar help screen. But maybe you can.

  4. #14

    Default Re: Unzipping and Unraring

    OK, I have very limited skills at the terminal. I'm trying to figure out how to make how to make ken_yap's code work for rar.
    I tried this, but it doesn't work?
    for i in *.rar
    do
    mkdir "${i/.rar}"
    unrar e "${i/.rar}" "$i"
    done
    I basically just plugged rar where Ken_yap
    had zip. I know that zip and rar has different switches, but again I'm not experienced at the terminal. Any help?

  5. #15
    Join Date
    Mar 2008
    Location
    Kentucky
    Posts
    1,126

    Default Re: Unzipping and Unraring

    Quote Originally Posted by dobbs007 View Post
    OK, I have very limited skills at the terminal. I'm trying to figure out how to make how to make ken_yap's code work for rar.
    I tried this, but it doesn't work?
    I think Ark will work if you are running KDE, make sure you have rar/unrar installed as well.

    With rar/unrar installed, I have /usr/share/doc/packages/rar/rar.txt = user's manual for CLI.

    Winrar will run using Wine.
    Desktop Asus X-99 Viper. uefi & secure Boot, Win10, Leap 15.1; Laptop: ASUS GL752VW Optimus, uefi+Secure Boot, Win10, Leap 15.1 & T-weed and IMac

  6. #16

    Default Re: Unzipping and Unraring

    @ken_yap and snakedriver, thanks for your quick replies. But we need to go back to beginning of thread
    to understand my question.
    post#1 silkmaze
    I can unzip or unrar a file without a problem, but how can I do the same for multiple zipped or rared files
    I understand about rar and zip and I use them from both gui (ark & xarchiver) and the cli. No problem there. But like silkmaze stated, it can be very tedious when processing multiple files. I have a lot of files archived and sometimes I end up processing 20-50 rar files at a time. I was looking for
    a way to streamline the process. Sorry, I should have made myself clear at the beginning....

  7. #17
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: Unzipping and Unraring

    So type in a loop like I showed you and do them all one after the other automatically. If your rar files have a path and they are distinct, extract with the path and there should be no clashes. Otherwise you could do something like this to extract to distinct directories.

    Code:
    for i in *.rar
    do
      d="${i/.rar}"
      mkdir "$d"
      (cd "$d"; unrar e ../"$i")
    done
    unrar seems to have an "ad" switch which might do what you want without having to do the cd, but I'm not sure what the author means by append directory, did they mean prepend directory really.

  8. #18

    Default Re: Unzipping and Unraring

    @ken_yap thank you
    for i in *.rar
    do
    d="${i/.rar}"
    mkdir "$d"
    (cd "$d"; unrar e ../"$i")
    done
    This command works perfectly for what I need. Thanks for your quick reply....

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •