The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Copying & moving en masse anekab UNIX for Dummies Questions & Answers 4 06-02-2008 09:50 AM
Moving Files iAm4Free Shell Programming and Scripting 5 03-28-2007 01:13 AM
copying/moving partition antalexi SUN Solaris 4 11-11-2006 03:59 PM
moving between vi files aya_r Shell Programming and Scripting 2 08-23-2005 01:36 AM
moving files ?? rocker40 UNIX for Dummies Questions & Answers 9 11-09-2003 05:36 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 10-10-2008
Registered User
 

Join Date: Mar 2008
Location: India
Posts: 10
Post FTP files are not moving/copying

Hi

I want to FTP some file from one server to another server, those file should copy from one server to another and then move the same files to another folder in the same server. I have written the code but the text files are moving and coping but the remaing file are not moving or coping to another server or different folder. Would you please help on this

EX: Server1 and server2

Server1 is having folder abc/bcd/cde and having file .txt,.xls,.eof, etc..
i want to copy into Sever2 as abc/bcd/cde of all above said files
and also move to abc/bcd/cde/back in to sever1

Code:


#!/bin/sh

cd /abc/bcd/cde

FTP_SRVR=<host name>
FTP_USR=xxxxxx
FTP_PWD=zzzzzzzz

TODAYS_FILE=&DAY.&HR.&MIN.&SEC

ftp -vn <<EOF

open $FTP_SRVR
user $FTP_USR $FTP_PWD
cd /abc/bcd/cde

binary

mput $TODAYS_FILE

bye

EOF
mv /abc/bcd/cde/$TODAYS_FILE /abc/bcd/cde/back



Regards,
Sridhar
Reply With Quote
Forum Sponsor
  #2  
Old 10-10-2008
Moderator
 

Join Date: Sep 2007
Location: Germany
Posts: 958
What error do you get?

This looks strange to wrong:
Quote:
TODAYS_FILE=&DAY.&HR.&MIN.&SEC
This will not be substituted to any usable by the ksh or bash. Maybe you use the date command like:
Code:
TODAYS_FILE=`date +%d.%H.%M.%S`
Reply With Quote
  #3  
Old 10-10-2008
Registered User
 

Join Date: Mar 2008
Location: India
Posts: 10
Hi

I .txt files are copying from sev1 to sev2 but the remaing files are not copying/mvoing to another file
and getting error like "mv: cannot rename /sap/DB1/hulftuser1/temp/ to /sap/DB1/hulftuser1/temp/back/tem
p/: Invalid argument"

could you please help
Reply With Quote
  #4  
Old 10-10-2008
wempy's Avatar
Registered User
 

Join Date: Jun 2006
Location: Harpenden, UK
Posts: 177
does the /sap/DB1/hulftuser1/temp/back directory exist?
Reply With Quote
  #5  
Old 10-10-2008
Registered User
 

Join Date: Mar 2008
Location: India
Posts: 10
hi

Yes it exists..
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:54 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0