I need a shell script that basically does this:
- Searches in a folder for all the txt files, and for each one it finds, creates a individual zip file with the same of the txt file it found + .zip.
- After that moves the created zip file to the txt file.
Basically its a script to substitute a list of txt files for its zip equivalent but keeping the same name.
I’ve have used find to find the files that I want to zip:
find . -name '.txt.' -print
The Results are:
./InstructionManager.txt.0
./InstructionManager.txt.1
Those are the files I want to zip individually (of course they will be a lot more), but don’t know how to use them as arguments individually for make commans like:
zip ./InstructionManager.txt.0.zip ./InstructionManager.txt.0
mv ./InstructionManager.txt.0.zip ./InstructionManager.txt.0
zip ./InstructionManager.txt.1.zip ./InstructionManager.txt.1
mv ./InstructionManager.txt.1.zip ./InstructionManager.txt.1
Any Ideas? And no, i don’t want a zip with all the files :S
Thanks
.txtfiles-execzips the files-execrenames the zipped files to the original namesNote that this procedure overwrites the original files. To be sure that the new files are actual zip files, you can do:
Which should return: