The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages 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 12:50 PM
Moving Files iAm4Free Shell Programming and Scripting 5 03-28-2007 04:13 AM
copying/moving partition antalexi SUN Solaris 4 11-11-2006 06:59 PM
moving between vi files aya_r Shell Programming and Scripting 2 08-23-2005 04:36 AM
moving files ?? rocker40 UNIX for Dummies Questions & Answers 9 11-09-2003 08:36 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-10-2008
mahantysk mahantysk is offline
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
  #2 (permalink)  
Old 10-10-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,257
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`
  #3 (permalink)  
Old 10-10-2008
mahantysk mahantysk is offline
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
  #4 (permalink)  
Old 10-10-2008
wempy's Avatar
wempy wempy is offline
Registered User
  
 

Join Date: Jun 2006
Location: Harpenden, UK
Posts: 205
does the /sap/DB1/hulftuser1/temp/back directory exist?
  #5 (permalink)  
Old 10-10-2008
mahantysk mahantysk is offline
Registered User
  
 

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

Yes it exists..
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 09:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0