nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

shell script for ftp the file

This is a discussion on shell script for ftp the file within the Shell scripting forums, part of the Development/Scripting category; Hi all , i need your help , it's very urgent i want the shell script to ftp the file ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 08-14-2007, 04:53 PM
Junior Member
User
 
Join Date: May 2007
Posts: 4
Rep Power: 0
vishal_titre is on a distinguished road
Default shell script for ftp the file

Hi all ,
i need your help , it's very urgent
i want the shell script to ftp the file from perticular server and copy in to another server.

Thanks
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-16-2007, 12:46 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Ubuntu
Posts: 1,036
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Code:
#!/bin/sh
BAK="/backup" # store all backup files here
FTPU="ftp-username"
FTPP="ftp-password"
FTPS="ftp-server-ip"
NOW=$(date +"%d-%m-%Y")
lftp -u $FTPU,$FTPP -e "mkdir backup/$NOW;cd backup/$NOW; mput $BAK/*; quit" $FTPS
You must have lftp ftp client installed. Above script will copy all files from /backup to ftp server backup/dd-mm-yyyy format.

See More script @ Shell Script Directory : FTP
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #3 (permalink)  
Old 08-17-2007, 02:46 PM
Junior Member
User
 
Join Date: May 2007
Posts: 4
Rep Power: 0
vishal_titre is on a distinguished road
Default Need script for following . plz help it's very urgent

Thanks for your reply , i need your help agin to solve my following problem.

I want the command that should look for files which were created in the last 2 hrs.
For example let's say the following files were created in the server

8 am - mpsacba_20070815_08
9 am - mpsacba_20070815_09
10 am - mpsacba_20070815_10
11 am - mpsacba_20070815_11
12 pm - mpsacba_20070815_12
1 pm - mpsacba_20070815_13

When our process runs at 10 am it should pick up mpsacba_20070815_09
and mpsacba_20070815_10 (which are the files which are created since
the last run). it should pick up those files where were created since the last
time our process ran.
Reply With Quote
  #4 (permalink)  
Old 12-10-2007, 09:40 AM
anilvrathod's Avatar
Junior Member
User
 
Join Date: Dec 2007
Location: Pune
My distro: Red Hat
Posts: 13
Rep Power: 0
anilvrathod is on a distinguished road
Default

Dear friend use this, it will help you

FILE_NAME="path_of_file"
HOST='IP Addr. of ftp server'
USER='user_name'
PASSWD='user_passwd'
ftp -nv <<EOF
open $HOST
user $USER $PASSWD
cd db_backups/PUNE/
put $FILE_NAME
EOF
__________________
Anil V. Rathod
RHCE
System Administrator
Styling Studio, ERC
INCAT | A TATA Technologies Company
www.incat.com www.tatatechnologies.com Email- anil.rathod@incat.com
------------------------------------------------
Cell No. +91 9767209168
------------------------------------------------
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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

Similar Threads

Thread Thread Starter Forum Replies Last Post
Shell Script to Automatically Delete a File via Cron Job kakarla Shell scripting 2 01-29-2008 09:54 AM
writing a shell script to find out my shell name jaymob123 Shell scripting 1 10-08-2007 01:36 AM
Shell scripting - Removing file extension urbanreformer Shell scripting 3 03-07-2007 09:44 PM
Shell script to delete a file with a dialog utility shankar100 Shell scripting 4 03-02-2007 11:22 AM
error shell script no such file or directory /bin/sh Linux software 1 01-08-2006 09:34 PM


All times are GMT +5.5. The time now is 05:51 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36