Am Tue, Jan 14, 2025 at 07:06:16AM -0600 schrieb Dale: > Michael wrote: > > On Monday 13 January 2025 14:17:41 Greenwich Mean Time Dale wrote: > >> > > It does this by default when you select to 'Extract here'. For example, > > the > > archive foo.zip will be extracted into a new directory called foo/ and all > > compressed files in foo.zip will be extracted into foo/. > > […] > > That seems to work like the old way. I guess the default changed but it > didn't make sense given how it used to work.
I thought it would behave like you expected – always create a subdir for each ZIP. I could reproduce that it does not. So I looked at Ark’s settings: there is an option to create a subdirectory for a ZIP as soon as the zip contains more than one item. So it is still there, but not for every file. > >> I tried to figure out how to do this on the command line but my head > >> hurts. Banging that wall isn't any fun. > > I don't think a single command can achieve this. Unzip will ask if you > > want > > to overwrite files already extracted in a previous attempt and it will > > create > > a directory to store the extracted files if one does not exist, but it will > > not ask to rename an existing directory. > > > > > >> Anyone been able to figure out how to do this? I got a few hundred .zip > >> files and doing them one by one just isn't a good option. > >> > >> Dale > >> > >> :-) :-) > > > I figured if there was a command line way, it would require sed, awk, > find and other things I don't understand. Don’t give one-liners more credit than they’re due. All you need is a for-loop over all ZIP files, calculate an ouput dir by removing the trailing “.zip”, and finally call unzip with both: for z in *.zip; do unzip "$z" -d "${z%.zip}"; done If you want to be smart, omit the extraction if the output directory already exists, to avoid overwriting stuff: # for-loop: cut off ".zip" does dir exist? yes no for z in *.zip; do d="${z%.zip}"; [ -d "$d" ] && echo "Skipping $z" || unzip "$z" -d "$d"; done -- Grüße | Greetings | Salut | Qapla’ Please do not share anything from, with or about me on any social network. ...llaw eht no rorrim ,rorriM