petepalmer
asked on
Quick script
Hi,
I need to write a script that will take all the files ending in .sal in the current directory (say /tmp/) and create individual zip files i.e :
test.sal -> test.zip
There could be any amount of .sal files...
I'd rather do this with a bash script but can use Perl in a pinch....
Thanks in advance!
I need to write a script that will take all the files ending in .sal in the current directory (say /tmp/) and create individual zip files i.e :
test.sal -> test.zip
There could be any amount of .sal files...
I'd rather do this with a bash script but can use Perl in a pinch....
Thanks in advance!
ASKER
Very close.... but.... :)
The final name needs to be (in the case of test.sal) test.zip not test.sal.zip :)
The final name needs to be (in the case of test.sal) test.zip not test.sal.zip :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
450 to sunny as the answer was spot on, 50 for raven for the assist :)
find /tmp -type f -name "*.sal" | while read fname
do
gzip -c $fname > $fname.gz
done
Cheers!
sunnycoder