I am trying to move zipped text files from a remote server to a remote tape storage facility, through my home directory. What I want to do is get the zip file (using scp), unzip it, copy the output text file which was inside (using rfcp) to the tape storage server, and then delete them both from my home.
The problem is I can't find a way to redirect the output of the 'unzip' command (aka the text file) to use it for other commands.
Here is what I came up with :
#!/bin/sh
cat list-zip.dat | \
while read filename1
do
echo "Variable filename is set to $filename1..."
# Copy the zip file from the server
scp lardcs@atlasgw:BUFFER-HV/$filename1 .
# Here I want to unzip the file and put the
# output text file as an argument for the rfcp command
# Copy the text file to the tape storage pool disk
rfcp $filename2 /castor/cern.ch/atlas/LargFec/HighVoltage
rm $filename1 # delete the zip file
rm $filename2 # delete the text file
done
My list-zip.dat is a simple list of the zip files I've created using 'ls > list-zip.dat'
I thought about that, the problem is the rfcp command, which does not support wildcards... It's a command used to copy files to a tape storage unit through a disk pool, and it was developped by people here at CERN.
Anyway through hardcore web-browsing I managed to solve my problem, I just did a "ls | grep stuff > file.dat" and read the file to feed the filename to the rfcp command. And it works !
Thanks again and see you around.
Cheers!