Results 1 to 5 of 5
I have a lot of zip files I need unzipping that have spaces in their name.
Code:
for z in *.zip; do unzip “$z”; done
Does fine except it unzips ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 06-29-2012 #1
Batch unzip
I have a lot of zip files I need unzipping that have spaces in their name.
Does fine except it unzips into the main folder. That is not good as it confuses things and I have multiple files with the same name. Is there a command that will create a new folder with the same name as the zip file?Code:for z in *.zip; do unzip “$z”; done
I do know that ark can do that with the -ba commands BUt I do not know how to get around the problem of spaces in names.
- 06-30-2012 #2Linux User
- Join Date
- Jan 2005
- Location
- Saint Paul, MN
- Posts
- 416
- 06-30-2012 #3
Tried and got:
As I am a total noobie to code and get lost very fast in any manual reading, I have no clue what is missing.Code:bash: syntax error near unexpected token `)'
PS: Must say though that I love linux because it is far superior in many ways to Windows and saves a bundle on hardware. Once I do figure out what to do I do use console for a lot of things.
- 07-02-2012 #4
- 07-03-2012 #5Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,746
use the -d flag to tell unzip to make a directory. make the directory name based off the zip filename, e.g.:
Code:#!/bin/bash for zip in *.zip; do dir=$(basename $zip .zip) unzip -d $dir $zip done


Reply With Quote

