How to extract a zip file to a specific folder?

244

Solution 1

We'll extract to a different folder to be sure that permissions aren't in our way:

  1. Open a terminal (Ctrl+Alt+T should work).

  2. Now create a temporary folder to extract the file:

    mkdir temp_for_zip_extract
    
  3. Let's now extract the zip file into that folder:

    unzip /path/to/file.zip -d temp_for_zip_extract
    

You should now have the contents of your zip file temp_for_zip_extract and can copy them into the desired folder.

If you can't copy the files to your folder, then check the permissions on your target folder.

The path to the downloads folder depends on what you used to download it to, try ~/Downloads. If you can't find it, then try this in a terminal:

cd ~;  find -name 'filename.zip'

You can also use a file manager, of course. There is Nautilus, Nemo, Thunar and many more, depending on your environment. Start the file manager and double click on your zip file, just like you would do in Windows.

Solution 2

Your targeted directory is owned by root (/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins), so you cannot write to it as a normal user.

Instead of mucking around with permissions, you can use sudo to unzip as the superuser.

sudo unzip ~/Downloads/whatever.zip -d "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins"

I suggest you do this to a temporary directory first to ensure the files are what you expect and will not damage/destroy your plex installation:

unzip ~/Downloads/whatever.zip -d /tmp/whatever

then cd /tmp/whatever and verify that contents are what you expect. If so, then go ahead with the sudo command I showed above.

Share:
244
Youcef
Author by

Youcef

Updated on September 18, 2022

Comments

  • Youcef
    Youcef over 1 year

    I have this quora webpage as a sample

    It does contain 4 "View Upvoters" buttons Using this code, I want to get all 4 button in order to click them one by one later.

    upvoter_list = wait.until(EC.presence_of_all_elements_located((By.CLASS_NAME, 'AnswerVoterListModalLink')))
    

    print(len(upvoter_list)) gives me 4, which is correct when I print the text of the first element of upvoter_list

    print(upvoter_list[0].text) 
    

    I get 'view upvoters' as a result but when I print the remaining, i get the empty result,

    print(upvoter_list[1].text)
    

    what is the problem?

    • Admin
      Admin over 9 years
      Are you limited to command line? What folder are you trying to extract to? Is the extension .zip?
    • Admin
      Admin over 9 years
      yes the extension is .zip im trying to extract the zip file to plex media server plug ins ...its in my downloads folder but when i try and extract to new directory it says i dont have permission
    • Admin
      Admin over 9 years
      Into which folder are you trying to extract it to?
    • Admin
      Admin over 9 years
      var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins to be exact is where i want it to go
    • Andersson
      Andersson over 5 years
      I see only 2 buttons and text printed for both as expected
    • Youcef
      Youcef over 5 years
      No, there is 4 view upvotes buttons, when you print the text of the first element of upvoter_list you get 'view upvotes', but for the remaining you get empty result
  • Tj Cooke
    Tj Cooke over 9 years
    ok now i guess im typing wrong pathname ....feel stupid asking this but what would be the default path to my downloads folder in terminal?
  • Tj Cooke
    Tj Cooke over 9 years
    basically i want to add a plug in to my plex media server i just need to add this bundle there so i can install channels to my server
  • Jetson Earth
    Jetson Earth over 9 years
    See my edit on how to find your file. I believe you only have a permission problem.
  • Tj Cooke
    Tj Cooke over 9 years
    yeah its a permissions problem and having no luck finding it in terminal i can see it under files under my name /home/Downloads but cant find in terminal says no such file or directory
  • Tj Cooke
    Tj Cooke over 9 years
    isnt there a program or something that will just unzip to appropriate folder with permissions already set?
  • Jetson Earth
    Jetson Earth over 9 years
    Added info on file managers
  • Tj Cooke
    Tj Cooke over 9 years
    ok i have opened it using file roller and that's where i get permission issues when extracting...can you recommend an easy quick file manager i can install and use?
  • Dan
    Dan over 9 years
    Open Nautilus as super user. gksudo nautilus
  • Tj Cooke
    Tj Cooke over 9 years
    That did it! thanx so much it was baffling but its in and working as far as i can tell anyways lol
  • Peter Chaula
    Peter Chaula over 6 years
    Thanks. The option is on the right section of the command help. That's why I couldn't see it
  • Peter Chaula
    Peter Chaula over 6 years
    I didn't find it again for the second time
  • Youcef
    Youcef over 5 years
    Thanks for the code, what do i have to add in order to get the content generated by the click event? which is in this case the name of the upvoters
  • Youcef
    Youcef over 5 years
    Note that p.click () is giving me error code, element not clickable
  • Timo
    Timo about 3 years
    from the docs (man unzip): The default behavior (with no options) is to extract into the current directory (and subdirectories below it) all files from the specified ZIP archive.
  • Boris Verkhovskiy
    Boris Verkhovskiy about 2 years
    I just get a directory with one directory (the old name) inside. How do I remove that level?
  • Boris Verkhovskiy
    Boris Verkhovskiy about 2 years
    I end up with /tmp/whatever/whatever that actually has all the files. How do I remove that if I don't know the name of the second whatever?