LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-27-2010, 07:22 AM   #1
ashishshukla
Member
 
Registered: May 2008
Posts: 35

Rep: Reputation: 15
Question Automate FTP / Scripting FTP Transfers files from linux to windows m/c


Hi Friends,

I need to transfer file from linux to window m/c through ftp in daily basis. Daily file name change to today's date (e.g fullbackup_yyyymmdd) and previous date's file is deleted.

as i m not good in shell scripting. please help me how i can do this. I searched it and got following script -

#! /usr/bin/ksh
HOST='W.X.Y.Z'
USER='XXXX'
PASSWD='YYYY'

exec 4>&1
ftp -nv >&4 2>&4 |&

print -p open $HOST
print -p user $USER $PASSWD
print -p cd directory
print -p binary
print -p put ash.txt
print -p bye

wait
exit 0

but still getting error -

test_ftp: line 9: print: command not found
test_ftp: line 10: print: command not found
test_ftp: line 11: print: command not found
test_ftp: line 12: print: command not found
test_ftp: line 13: print: command not found
test_ftp: line 14: print: command not found

Also, i m getting this -
test_ftp: line 8: syntax error near unexpected token `&'
test_ftp: line 8: `ftp -v -n >&4 2>&4 |& '


where there is no space between "|" and "&"

Kindly help me.
Thanks
Ashish
 
Old 01-27-2010, 08:55 AM   #2
razzera
Member
 
Registered: Dec 2009
Posts: 105

Rep: Reputation: 15
install a package called "ftp-upload" onto your server and then use this bash script and put in in a cron.

Quote:
#!/bin/sh

ftp-upload -h IP -u server --password PASSWORD -b -d / /PLACETOUPLOADFROM/FILETOUPLOAD

echo transfer done
 
Old 05-26-2016, 07:59 AM   #3
mawad71
LQ Newbie
 
Registered: May 2016
Posts: 1

Rep: Reputation: Disabled
this issue resolved by this script

#!/bin/bash
HOST='your.ftp.site'
USER='remoteusername'
PASSWD='remotepasswd'

ftp -n -v $HOST << EOT
ascii
user $USER $PASSWD
prompt
cd upload
ls -la
bye
EOT
 
Old 05-26-2016, 09:34 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,342
Blog Entries: 36

Rep: Reputation: Disabled
Something wrong with sftp?
ftp is incredibly insecure.
 
1 members found this post helpful.
Old 05-26-2016, 10:06 AM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 20,708

Rep: Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090Reputation: 5090
Quote:
Originally Posted by Habitual View Post
Something wrong with sftp? ftp is incredibly insecure.
Was wondering the same thing...but since this thread had been closed for SIX YEARS before mawad71 re-opened it (with a script that didn't address the OP's original question), I didn't think it mattered.
 
Old 05-26-2016, 10:10 AM   #6
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,342
Blog Entries: 36

Rep: Reputation: Disabled
Coffee is required.

Thanks T
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
FTP files from windows to linux investmentbnker75 Linux - General 4 09-11-2008 05:30 PM
FTP files from Linux to Windows myint45 Linux - Newbie 2 01-31-2008 07:05 PM
FTP Command Line (Scripting Multiple FTP gets) Critcho Linux - Software 3 01-05-2007 12:57 AM
Linux/UNIX differences with vi and ftp ascii transfers KenMadsen Linux - Newbie 2 06-20-2005 10:51 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration