Advertisement

03.06.2008 at 07:57AM PST, ID: 23219933
[x]
Attachment Details

Copying files within a server using ftp

Asked by stuffedparrot in Shell Scripting

Tags:

Hello,

I have a script that does the following, copies multiple files from ServerA and puts them on ServerB.

What I need help with is:

the syntax that will connect me back to ServerA so that the original files can be moved into a different directory once they have finished copying.

We only have access to ServerA via ftp.

My code to date is attached.

Thank you.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
#!/bin/sh
server="IP Address"
user="user:pass"
curl="/usr/etc/appletalk/curl"
destdir="/xxx/Clients/T/The Economist/Pagestore/Archive"
 
 
# Here we pull all files back in one go 
cd "$destdir"
$curl -s -S -f -O --user $user "ftp://$server/From_econ_test/Archive{Mon,Tue}{0015,0745}.zip"
 
 
#Here we unzip the files
for file in *.zip
do
  echo $file >>$LOG
  unzip -uo $file
done
 
 
#Here we move the original zipped files on ServerB once they have unzipped
mv -f *.zip Zipped_files
 
 
[+][-]03.06.2008 at 08:55PM PST, ID: 21067467

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.06.2008 at 11:34PM PST, ID: 21068056

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.13.2008 at 02:35PM PDT, ID: 21121124

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Shell Scripting
Tags: unix
Sign Up Now!
Solution Provided By: mikelfritz
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628