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
Auto copy for files from folder to folder upon instant writing Bashar UNIX for Advanced & Expert Users 2 08-21-2008 02:44 PM
unzip files in a different folder agarwalniru UNIX for Dummies Questions & Answers 2 03-25-2008 03:36 PM
unix C++: get the files from a folder nadiamihu High Level Programming 2 11-29-2006 05:23 AM
delete all folders/files and keep only the last 10 in a folder melanie_pfefer Shell Programming and Scripting 3 11-17-2006 03:33 PM
deleting files in folder amon Shell Programming and Scripting 10 02-21-2006 10:48 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-08-2007
dineshr85 dineshr85 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 23
ftp a files from a folder

Hi

Can anyone give me a shell script to ftp all the files in a folder to a another machine .And if the ftp is sucees i want to move the files to the same to another folder in the same client m/c
  #2 (permalink)  
Old 10-08-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
look at the ftp commands "mget" and "mput".
  #3 (permalink)  
Old 10-08-2007
royalibrahim royalibrahim is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 86
Hi, please correct me if there is any wrong in this script. Hope the files which are intended to be transfered are ascii files.

Code:
#!/bin/sh
result=`/usr/bin/ftp -dvin << EOF
open "$1"   # IP address (or) hostname
user <username> <passwd>
lcd /home/foo/temp
cd /home/foo/cfiles
ascii
hash
bell
mput *.c
close
bye
EOF`

value=`echo "$result" | grep "226 Transfer complete" | wc -l`

[ "${value}" -ge 1 ] && { echo "$value files transferred"; exit 0; }
echo "FTP Failure"; exit 1
you can use 'on' command to move the files which are transfered to another location in that remote client. See man page to get more details about 'on' command.

Last edited by royalibrahim; 10-08-2007 at 02:00 AM..
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 08:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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