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
please help in rsync naree SUN Solaris 10 10-01-2008 04:34 AM
rsync vs cp jsy UNIX for Dummies Questions & Answers 1 03-24-2008 01:51 PM
rsync over ftp Hitori UNIX for Advanced & Expert Users 2 03-14-2008 10:42 AM
Rsync darknite87 UNIX for Advanced & Expert Users 1 06-06-2002 12:37 PM
rsync wz253 UNIX for Dummies Questions & Answers 6 09-04-2001 03:44 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-23-2005
Registered User
 

Join Date: Jul 2005
Posts: 31
rsync in ftp

Hello, everyone.

I want to UP files in folder: FROM which is in local.
to server folder: TO by ftp script.

Code:
cd /$HOME/FROM

# Begin FTP
ftp -i -n $HOST << END
user $USER $PASSWD

# Command in FTP
cd public_html/TO
rsync -auv --delete FROM TO <--- I think this won't work but I want to do like this!!

quit
END
# End FTP
Now, in my local FROM folder, I have
2.txt 3.txt 4.txt
and in TO folder,
1.txt 2.txt 3.txt

there is some changes in file 3.txt, and i want to do on TO folder,
1. remove 1.txt
2. make no change to 2.txt
3. change 3.txt (because it has been changed in local)
4. put 4.txt

After this, TO folder has changed to:
2.txt 3.txt 4.txt
Now 3.txt is the new one.

Please tell me how to do this in compact script!!
THANKS.
Reply With Quote
Forum Sponsor
  #2  
Old 10-23-2005
Registered User
 

Join Date: Jul 2005
Location: Oak Park, IL
Posts: 100
FTP Rsync mixup

I think you're mixing your commands.

ftp is a command for doing file transfers. Type "ftp" from your shell command line, then type "help". It will tell you what commands are available.

rsync is another command for sync'ing two directories.

So first, we have to know: what do you have available, rsync or ftp? Are you the administrator of your computers? How important is security to you? (rsync uses rexec which is notoriously insecure) Can you compile problems on your computers? If so, you may want to use ssh and the scp command. Do you have perl? This may make testing file modification times easier to test.

The easiest answer, by far, is to use rsync. This is what rsync was designed to do. And for that you do not need a script- a one-line rsync command is all you need.

But it sounds like you don't have it, otherwise you wouldn't be asking for a script, no? Well with more information we would be in a better position to answer the question in a way that meets your needs.
Reply With Quote
  #3  
Old 10-23-2005
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,644
Quote:
Originally Posted by mschwage
rsync uses rexec which is notoriously insecure
Actually, rsync can use either rsh/rexec or ssh, or can even be run as a daemon.
Reply With Quote
  #4  
Old 10-23-2005
Registered User
 

Join Date: Jul 2005
Posts: 31
Thank you for kindness.
This is my env.

ftp> help
Commands may be abbreviated. Commands are:

! disconnect lpage nlist rate sndbuf
$ edit lpwd nmap rcvbuf status
account epsv4 ls ntrans recv struct
append exit macdef open reget sunique
ascii features mdelete page remopts system
bell fget mdir passive rename tenex
binary form mget pdir reset throttle
bye ftp mkdir pls restart trace
case gate mls pmlsd rhelp type
cd get mlsd preserve rmdir umask
cdup glob mlst progress rstatus unset
chmod hash mode prompt runique usage
close help modtime proxy send user
cr idle more put sendport verbose
debug image mput pwd set xferbuf
delete lcd msend quit site ?
dir less newer quote size
ftp>

Of course, there is no rsync command.

>what do you have available, rsync or ftp?
I have both.

>Are you the administrator of your computers?
I am admin of my notebook, but not admin of web server (XREA.com).
I have my HomePage, on this server, and I want to update automatically.

>How important is security to you?
I want to send some of my personal text files, but I think security is not so important.

>Can you compile problems on your computers? If so, you may want to use ssh and the scp command.
I can't understand about this.

>Do you have perl?
Yes. And I can understand it.

>The easiest answer, by far, is to use rsync.
I have to input password and username, when I want to get into the server computer.
So, I don't know what the expression on rsync will be.

Does this make sense?
Sorry for my bad English.
Reply With Quote
  #5  
Old 10-23-2005
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,644
I think this thread in the frequently asked questions is what you are looking for.
Reply With Quote
  #6  
Old 10-24-2005
Registered User
 

Join Date: Jul 2005
Posts: 31
I will learn this.
THANK YOU!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:59 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