In the bash below in each .zip there is a folder to be extracted Variants that I am trying to make unique by adding the prefix, before the _ from the .zip. The script does execute, but the prefix is not added to the extracted folder. Rather the Variants folder is added to each file within it. Thank you .
bash
/home/cmccabe/tmp
desired output --- zip extracted --- example after executing currently --- one of 5 files, all extated in the same way ---
I think that you are trying to do this in a single step, but actually you need to have more. Your attempt also has to be certain that you only have one file in each .zip but it's not clear if this is the case.
The problem is that unzip probably doesn't just give you the extracted filename(s) as output. You might well be better to make a temporary directory to extract the files to, then process all the files you find there. If the files are large, make the temporary directory in the same filesystem as the desired target. The default for mktemp is to make a directory with pattern /tmp/tmp.XXXXXXXX (might vary depending on OS) but you can set a template for the name to use so I have used it to set this all up in /data. Obviously change this to something meaningful for yourself.
There are a few variations on what you are asking for, but I've guessed at this one:-
Does that do what you need or have I misunderstood your requirement?
I you are extracting multiple files, we might need to add a find into the loop to update the files safely.
I am trying to compare/confirm the output of an script using the perl below, which does execute. However I can not seem to print $1 and $2 in each line of the input separated by a tab in each line of the output. The input file is quite large so I have only included a portion, but the format is the... (0 Replies)
I am trying to create subdirectories in each folder in /home/cmccabe/Desktop/NGS/test/*. When I use echo I can see each folder in the directory, but I can not seem to add the commented out portion in bold. These are the sub-directories and sub-folders I am trying to add to each folder in... (1 Reply)
Hi,
I have a directory with Multiple subdirectories and 1000s of pictures (jpg) in each directory. The problem is that each directory has a 001.jpg in them. I want to append a unique name (the directory_name)would be fine. and then move them to one main backup directory once they have been... (1 Reply)
I am trying to zip a folder, its size is more than 3 GB. I used below command
zip -r foo middleware -x "*path*"
This command fails every time with message
"Filesize exceeded limit"
Can some one help me how to over come this problem and zip the entire folder without splitting it.
... (2 Replies)
Hello,
I have two folders.
One has 1183 text files (folder A).
The other (folder B) has 1160 of those 1183 files (the contents in these 1160 files are identical to the contents in the corresponding files in the other folder, but the names of the files in this folder are completely different... (2 Replies)
Hi guys,
I have a question about the zip command. Right now I have a directory with some files and folders on it that I want to compress. When I run the zip command:
zip foo -r
I am getting a foo.zip file that once I unzip it contains a foo folder. I want to create the foo.zip, but that... (1 Reply)
Hello,
I am an amature at UNIX commands and functionality.
Please could you all assist me by replying to my below mentioned querry :
How can I upload a zip folder on a unix path from my windows folder?
Thanks guys
Cheers (2 Replies)
Hi,
I have a folder that contains a few sub-folders. I would like to zip that folder and KEEP the subfolders. What it does at the moment is taking all the files within the subfolders and zipping them into one big file (zip -r ...). Does anyone know the UNIX command to keep the subfolders in the... (3 Replies)