7z x file.rar produces empty txt files - zip

I want to extract a rar file on a server, where I don't have sudo rights. Unfortunately, no unrar is installed, but only 7zip. When I try to extract the rar file, that contains a bunch of txt files, via
7z x file.rar
the txt files are created, but they are all empty. I checked it locally and the rar file is not corrupted, so the problem lies somewhere else. I also receive the fellowing errors:
ERROR: Unsupported Method : extracted_file.txt
Sub items Errors: 153
Archives with Errors: 1
Does anyone know how to deal with that problem? Is there another way to extract the rar file potentially? I tried to write a python script, which uses the package rarfile, but it needs unrar to be installed.

Related

unziping files in linux folder

in Python I have the following command executed unzip '{dir}ATTOM_RECORDER/*.zip' -d {dir}ATTOM_RECORDER/ as a bash command. The python call works perfectly. my question is about the unzip command itself.
for some reason when unzip is called to expand any relevent zip files in the folder specified, not all the files WITHIN the zip is extracted. There's usually a rpt and a txt file. However, sometimes the txt file is not coming out and I do not have an error command.
How can I ensure the txt file is guaranteed to be extracted before moving on?
Thanks
While you want to unzip your specific zip file. There are many option to decompress any file from zip files. Easiest way is the ‘-l’ option with unzip command is used to list the contents of a zip file after extracting it.
Syntax: unzip -l [file_name.zip]

How to decompress tensorflow hub module in the terminal?

I want to download, decompress, and use a pretrained model from tensorflow-hub
After downloading I end up with a 1.tar.tar file, which I probably need to extract / decompress in order to be able to use it.
I can't wrap my head around how, I am working in a Linux terminal.
If your tar file is compressed using tar compression, use this command to decompress it. Make sure to be in the directory of the tar.tar file, it will decompress everything into the directory you are currently in.
$ tar xvzf 1.tar.tar
Where,
x: This option tells tar to extract the files.
v: The “v” stands for “verbose.” This option will list all of the files one by one in the archive.
z: The z option is very important and tells the tar command to uncompress the file.
f: This options tells tar that you are going to give it a file name to work with.
Nice to know:
A tarball is a group or archive of files that are bundled together using the tar command and have the .tar file extension.

tar directory contains ._ files

I extracted files from a tar directory and noticed that on my mac for each file there was also another file named ._<filename>. I did the standard procedure with:
import tarfile
with tarfile.open('file.tar.gz', 'r:gz') as tar:
tar.extractall()
The files contain something like:
Mac OS X 2PATTRP���Acom.apple.qua....
Can I get rid of those before extracting somehow? Or would I have to check if the file starts with ._ before doing so?

How to zip all txt files recursively in linux using zip?

I want to zip all .txt files in using zip command in linux recursively. For this, I'm using:
zip -r /home/folder/zipName /home/folder2/subfolder1/*.txt
and it is giving me the below error:
zip warning: missing end signature--probably not a zip file (did you
zip warning: remember to use binary mode when you transferred it?)
zip warning: (if you are trying to read a damaged archive try -F)
zip error: Zip file structure invalid
use
zip -r /home/folder/zipName /home/folder2/subfolder1 -i \*.txt
it will do what you expected.
I had the same error, and I found that the solution was to make sure that your zipName ends in .zip. Putting this here in case it can help somebody else.
This works for me ...
zip -r /home/folder/zipName /home/folder2/subfolder1/**/*.txt

linux wget download tar.gz as html?

I know the problem may seem naive to most of you but I couldn't find a solution. I'm using a linux virtual machine and I'm trying to download the apache-drill.tar.gz from enter link description herethe link (10 minutes tutorial they provide) I did the wget "link" but when I tried to extract the file using the tar -xvzf it gave me error messages as:
gzip:stdion:not in gzip format
tar: Child returned status 1
Error is not recoverable; existing now
Initially I thought it was the file format so I mv apache-drill.tar.gz apache-drill.tar and tar -xvf apache-drill.tar but still error. (file format different)
Then I started to check the size of the file, the original .tar.gz size is 134MB but when I tried:ls -lh apache-drill.tar.gz it's only 34KB which is much smaller than the real tar.gz file So I'm guessing wget is not downloading the file properly. Instead of the tar it actually downloads the html for me..
How can I fix this?
Thanks!
The HTML document you downloaded consists primarily of a bunch of links to mirrors hosting the actual file.
Pick one of them and download the response.

Resources