So, do you mean that you want to edit the zip file and change the file information? If this was a simple unix compressed single file it would not matter, but there is data written within the zip file like a mini-directory holding all the file details. It's the same with tar where multiple files can be collected.
I fear that you may need to extract the file, rename it and re-zip as your script does, however we can tidy up your script a little so that we don't call unnecessary external programs (grep, ls, etc.)
To get your loop started, you can simply:-
To slice a string with nice clear delimiters, you can use variable substitution. This looks like ksh or bash so:-
Date calculations form many threads on this forum. If what you have works for you, then it is probably the neatest you can get already.
When you are zip -d 'removing' the .txt file from the .zip, what will be left in the .zip? If it's nothing, then just remove the .zip file and create a new one of the required name for the extracted .txt
Hello, I have a text file "file.list" with the contents below.
file1
filename1
file2
filename2
file3
filename3
file1, file2 and file3 are files existing in the same directory as the text file file.list.
I want to rename file1 to filename1, file2 to filename2, as show in the text... (1 Reply)
HI ,
There are more than 100 zip files in a directory and i wanted to see if there is a max1157.txt file in any of the zip files without actually unzipping them. Could you please help. Thanks in Advance.
Karthik. (6 Replies)
Hi guys,
I want to change the name of zip file and the files in zip. eg. there are two zip files 100_ABC_20101020.zip 101_ABC_20101020.zip
100_ABC_20101020.zip
|
--100_A_20101020.txt
--100_B_20101020.txt
--100_C_20101020.txt
101_ABC_20101021.zip
|
... (0 Replies)
Hello to all,
I have a zip file with any name like FileName.zip, within the zip file there are more than 30 files with different extensions in the following format.
FileName_BMN_ROSJ.txt
FileName_THEUS.jpg
.
.
.
FileName_KWPWP.shx
I would like to unzip the file and rename each file... (2 Replies)
Okay so here's something that's confusing me: I have a script that's designed to remove the words "new_" from the front of any file except two exceptions and it looks something like this...
for i in new_*
do
if ] && ]; then
j=`echo "$i"|cut -c5-`
mv $i $j
fi
done
... (5 Replies)
Hi guys,
now, I have the following requirement:
1. Get all files under specified directory
2. the files modify date should be specified date
3. zip these files
4. transfer these files to another machine, assume ip, user and password are given.
could you pls provide good solution for... (1 Reply)
Hi,
I'm desperately in search for a solution of the following problem:
I have a directory full of zip-files. All these zip-files contain a single file with a name that should be used for the name of the zip-container.
Anybody a good idea. I'm an absolute beginner in shell scripting - so please... (7 Replies)
I'm working on a project that basically unzips three zip files.
When these unzip they create about 70+ directories with subdirectories of year/month with about 3 to 9 pdf files in each directory.
Basically, I'm needing to figure out a way to zip these pdf files up.
for instance the script... (1 Reply)
I want to loop through files in a directory but omit the file with the latest date in my list of files. How would I accomplish this?
Thanks (2 Replies)
I have bunch of files in win xp machine with
123456 E15 filename
112333.E20 filename
123412.E11 filename
you get the pic, I mount that xp machine's share into linux and try to do a mass rename to something simpler
E15 filename
E20 filename and so on..
I wrote below thinking that it... (8 Replies)