How to extract one file from a specific directory of a zip file

I got a zip file like this:

zipfile.zip |______ -JWQYBCVAQA= |_______ text.txt othergarbage.jpg othergarbage.deb othergarbage.whatever

I only need to extract text.txt

i tryed: unzip Externo.zip -x '/-JWQYBCVAQA=/behavior_packs' '/-JWQYBCVAQA=/db' '/-JWQYBCVAQA=/resource_packs' '/-JWQYBCVAQA=/level.dat' '/-JWQYBCVAQA=/level.dat.old' '/-JWQYBCVAQA=/world_icon.jpeg'

But it outputs that there is no files with those names

I don't know how to do this , any help is apreciated.

1 Answer

Don't use a leading slash, and just give the path to the file as the second argument:

unzip zipfile.zip -JWQYBCVAQA=/test.txt

You can also use wildcards:

unzip zipfile.zip '*/test.txt' 

For files/directories whose names start with -d or -x (which are the options allowed after the zip filename), to escape them you can prefix with \\ (\ for unzip itself, and the extra escape for the shell) or '\'.

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like