How to unzip files that are in individual folders? - file

I own a MacBook Air. I'm trying to unzip all of these folders all at once instead of double clicking on each zip file that are in each directory. Is it possible? If so, how? For example, Folder 1 contains Cow.zip and Pig.zip, Folder 2 contains Dragon.zip, Dog.zip, and Cat.zip and
Folder 3 contains Hen.zip and Flowers.zip. Folder 1, Folder 2, and Folder 3, are in File called Animals.

Try this:
open ./*/*.zip
This will recursively traverse all the folders in the current directory and open all .zip files (i.e. "double click"/unzip).
If you need to unzip lots of files, use this command instead to avoid numerous pop ups. (Replace path/to/folder with the path that contains the folders with zips/more folders)
find path/to/folder -name "*.zip" | while read filename; do unzip -o -d "`dirname "$filename"`" "$filename"; done;

Related

Copy a file from one archige directly to 2nd archive

Lets say I have archive1.zip with 3 files file1.txt, file2.txt and file3.txt and another archive with a folder folder 1 with file4.txt contained within it. How do I use winRAR or Winzip 27.0 either with command line or GUI, to transfer (copy, move) only file4.txt or folder 1 folder from archive 2.zip directly to archive1.zip
I have already tried using winRAR to add files from the 2nd archive to 1st archive in the file textbox but it cannot find the path and returns an error

How to create a batch file that will zip few different files in one .zip file

I want to create a batch/shell script for windows and mac that will take few different files with different types and will compress it to a .zip file.
I already saw a few questions and answers about it, but all of them either compress all the files in the folder or compress them individually.
Example (look at attached image):
I have a folder that contains 1.txt, 2.xml, a sub directory.
And I want to turn all of them into a .zip file.
If possible to get a solution both for windows and Mac.
On Windows there is the file 7zip.chm in directory %ProgramFiles%\7-Zip which is the help file of 7-Zip. Double click on this file to open the help.
On Contents tab there is the list item Command Line Version with the help pages:
Syntax ... Command Line Syntax
Commands ... Command Line Commands
Switches ... Command Line Switches
The target is to compress everything in folder test into a ZIP file with name of the folder as file name.
This could be done for example with the command line:
"%ProgramFiles%\7-Zip\7z.exe" a -bd -mx=9 -r -y -- test.zip "C:\Path to Directory\test\*"
This command line adds (a) everything in directory C:\Path to Directory\test recursive (-r) to a ZIP file with name test.zip in current working directory without progress indicator (-bd) using best ZIP compression (-mx=9) with assuming Yes on all queries (-y).
In other words the file test.zip in current directory contains after execution the subdirectory main with everything inside and the files 1.txt and 2.xml.

While Zipping files suing batch script it Zips the folder structure as well

I have files at location D:\data\Generate which needs to be Zipped and copied to
D:\data\Upload directory
I used command
set generate=D:\Data\Generate
set upload=D:\Data\Upload
cd %generate%
zip - * >> %upload%\%%i.zip
If I run this command from cmd it works fine but while running it from a
scheduler (ex: Control-M) it actually copies all the files from Control-m config directory into the zip folder.
If I explicitly mention the directory under whose the files needs to be zipped
zip - %generate%*.* >> %upload%\%%i.zip
the final zip folder actually contains the whole directory structure too instead of just the files.
ex: Zip file contains Data folder, Generate folder and the files under Generate folder
Can someone please help with this?
ok I got some clue with this.
This is a problem with Windows itself, for ex:
You open CMD
You are currently in directory C
then you run a command cd D:\data
even after this when you do dir, it will list out all the jobs in C directory only.
if you run D: after the above CD it will actually go into D:\data directory and you can work on that directory
I am sure you are past this since two (2) years ago. Here is a way to do it. I did not understand what you wanted the .zip archive filename to be. There is nothing in the source code presented that would produce %%i.
powershell -NoProfile -Command "Get-ChildItem -File -Path 'D:\Data\Generate' | Compress-Archive -DestinationPath 'D:\data\Upload\i.zip'"

extract sub folder contents without parent folder using 7zip in batch files

I have one zip file in source path called crewing.zip, zip file structure is as follows:
crewing\Build\Areas
i just want to extract only the folders and files under Build, i dont want the parent folder Build to be in destination location
Source Folder path: \10.201.1.6\TempPath\CL1
Destination Folder path: D:\Client1\inetpub\wwwroot
Expected Result: D:\Client1\inetpub\wwwroot\crewing\Areas
in unzip format, below is the code which i tried in batch files
7za X \10.201.1.6\TempPath\CL1\crewing.zip -y -oD:\Client1\inetpub\wwwroot crewing\Build* -r
please help me now in destination parent folder build also obtained.
Try:
7z x -y -oD:\GWClient\inetpub\wwwroot \10.201.1.6\MariApps\GW\crewing.zip crewing\Build\*
You'll have to remove the Build dir afterwards.

Mac OS10.6.8 - A way of deleting or removing files from a folder, using a list of file names?

I have a folder with 2508 files (jpg and pdf) in it on my drive. I have a list in a .txt file of about 1000 files which I want to remove from that folder - either by deleting to trash, or removing to another folder.
Is there a utility - or possibly commands I can put into the terminal - which I can use to do this, without manually moving files while looking through my list?
(Context: The list is a list of orphaned image files put out by Dreamweaver - which I want to remove from the images folder of a given site)..
Any help appreciated.
Thanks.
Put this in the terminal:
cat filename-of-list-with-files | xargs rm

Resources