I have a folder structure like this:
Folder
- Sub-folder
- Sub-folder
- Archive
- Archive
- Sub-folder
- Sub-folder
- Archive
- Archive
I would like to extract all archives in all sub-folders.
When extracting an archive I want the files to extract in the same directory as where the archive is located then once it is completed extracting I would like to delete the archive.
I am trying to do this with 7zip from the command line using zip files.
I have got as far as this: 7za x -tzip -r -o "C:\Users\nath1\Downloads\testing"
Any help would be much appreciated.
Related
I wanted to know how to move files to a .zip archive. I'm using this code: xcopy C:\Folder C:\AnotherFolder\zippedFolder.zip. This copies the files from C:\Folder DIRECTLY into the archive, but I want to have that file in the archive (so i can doubleclick the archive and see the file unopened).
Want to do this to create an excel file with a .cmd
Use -m to import a file to a ZIP archive.
I found this on StackOverflow maybe it helps you.
How to move a file in to zip uncompressed, with zip cmd tool
But be careful it deletes the source file after it adds it to the archive. See the link for more details.
UPDATE
Instructions from this site. http://linux.about.com/od/commands/l/blcmdl1_zip.htm.
-m moves the specified files into the ZIP archive; actually, this deletes the target directories/files after making the specified ZIP archive.
If a directory becomes empty after removal of the files, the directory is also removed. No deletions are done until zip has created the archive without errors. This is useful for conserving disk space, but is potentially dangerous so it is recommended to use it in combination with -T to test the archive before removing all input files.
zip -m yourfile zip.file
I have a zipped archive version 0.0.1: myarch_0.0.1.tar.gz
When I extract it with tar, everything is unzipped and extracted in a myarch folder, stripping the version number.
ls
myarch_0.0.1.tar.gz
tar -zxvf myarch_0.0.1.tar.gz
ls
myarch/ myarch_0.0.1.tar.gz*
I want the extracted folder to be named: myarch_0.0.1/
How do I keep my version number stuck to the extracted folder name?
The name of an archive file, and the name of the files inside, have nothing to do with each other in general. If you want extracted directories to have a certain name, with a version number, then you have to create the archive with so named directories.
In this example, the extracted content is a directory named myarch, instead of your desired myarch_0.0.1. You can rename the directory and recreate the archive:
mv myarch myarch_0.0.1
tar zcf myarch_0.0.1.tar.gz myarch_0.0.1
That's it. When you untar this new archive, you will get a directory named myarch_0.0.1, simply because that's what you put inside. Even if you rename this file to mickeymouse.tar.gz, when you untar it, you will still get a directory named myarch_0.0.1, simply because that's what's inside the archive. Nothing to do with the filename of the archive.
Zip all the files in the specific directory and I need to place the zip file in the same folder through windows command prompt.
I know command for unzip as below
"unzip SRCPath -d DestPath "
I am looking all the text files to compress and place the zip file in the same folder.
I am trying to append a script in my JAVA program to unzip the files in specific folder by 7z. Here come below script. But I found that it will also extract the .zip files in subfolder.
7z e -aoa -ppassword c:\xxx\desktop\fromFolder -oc:\xxx\desktop\toFolder > nul:
What if I want to extract the .zip files located in "fromFolder" only and exclude all files in the subfolders of "fromFolder". Please advice, thanks.
Here's a question:
I have a folder named Root and it contains some files and folders. Using Winrar console commands, I need to create an archive Root.rar that should contain entire file/folder structure of Root and SHOULDN'T contain Root folder itself.
For example:
On drive:
Root-
|-SomeFile
|-SomeFolder-
|-SomeOtherFile
In the Root.rar archive:
SomeFile
SomeFolder-
|-SomeOtherFile
I tried to do this:
"C:\Program Files\WinRAR\winrar.exe" a -r Root.rar Root\*
But it also adds the Root folder.
Then I tried this:
"C:\Program Files\WinRAR\winrar.exe" a -ep -r Root.rar Root\*
In this case winrar didn't add the Root folder, but it also didn't add any other folders, and instead of folder tree I've got a bunch of unstructured files. Is there any way of adding the folder structure, ignoring the Root?
Thank you!
Use -ep1 (exclude base folder names) instead of -ep (exclude paths from names)