Ftp from unix


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Ftp from unix
# 1  
Old 03-08-2006
Ftp from unix

Hi ,

I have some files in my Unix Server and taking backups via ftp in the remote Unix Server date vise. ie) I have a file like test.dat in my Unix Server
and wants to take the backup like test.dat_MAR2006. I will receive the test.dat file every day , and only one back up in the reomte server. I want to append the remote file through ftp , my problem is appending the Date after the file name while ftp.

I tried the below code and its not working

ftp > append test.dat_`date +%b%y`

Your suggesion should be appreciatable.

Thanks & Regards
S.Sivakumar.
# 2  
Old 03-13-2006
You really need to work out the file name first then start the ftp session. You could do it in a script like this

Code:
Code:
# Need some way to get userid/password if not anonymous
# or could use "read"
userid=$1
password=$2

# File source and destination (or could just hardcode values below)
srcfile=test.dat
server=<name of destination server>
destdir=<destination directory>
destfile=${srcfile}_$(date +%b%y)

# FTP command with input in here-document
ftp -n $server<<EOF
user $userid $password
cd $destdir
append ${srcfile} ${destfile}
bye
EOF

# 3  
Old 03-14-2006
File name manipulation in FTP

YOUR_FILE_NAME=test.dat_`date +%b%y`


echo user $REMOTE_USER $REMOTE_PSWD > FTP_GET_file
echo append $YOUR_FILE_NAME >> FTP_GET_file
echo bye >> FTP_GET_file

ftp -inv $REMOTE_HOST < FTP_GET_file >> LOGFILE
if [ $? -ne 0 ]
then
echo "\n Failed: \n" >> LOGFILE
exit_status=1
else
echo "\n Successful\n" >> LOGFILE
fi

This will work... Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help with FTP in UNIX

Hi All, I am a beginner in Unix, wanted to know can we FTP one file located in one server to the another server location using Putty. The destination would require user ID and password to access the location. Also, the file that needs to be picked up should have the date of previous day. ... (1 Reply)
Discussion started by: richa shukla
1 Replies

2. Shell Programming and Scripting

FTP from windows to unix server using unix shell script

Hi, Is it possible to ftp a huge zip file from windows to unix server using unix shell scripting? If so what command i need to use. thanks in advance. (1 Reply)
Discussion started by: Shri123
1 Replies

3. Shell Programming and Scripting

UNIX script to FTP file from UNIX server to windows

Hi, I am new to this subject.....Can someone please help me out with the script... unix usernm "sdhftst" unix pwd "chsd13" windows usernm "dfghtst" windows pwd "chsd13" path..../xxx/xxxxx/xxxxxx/xxxxxxx please can u get me a script...its only one file to get ftp. Thanks... (2 Replies)
Discussion started by: himakiran9
2 Replies

4. Shell Programming and Scripting

ftp from windows to unix using a perl script on unix machine

i need to ftp a file from windows to a unix machine by executing a sript(perl/shell/php) from that unix machine.i can also use HTML and javascript to build forms. (3 Replies)
Discussion started by: raksha.s
3 Replies

5. UNIX for Advanced & Expert Users

MVS->Unix FTP : Using chmod as part of FTP.

We are transferring file from mainframes to unix, & in FTP process itself we would like to set access rights for unix machine. Has anyone used chmod command in association with site command in ftp? How it should be used? Thanks in advance. (1 Reply)
Discussion started by: videsh77
1 Replies

6. Shell Programming and Scripting

FTP script to FTP file to UNIX - Solaris

Hello, A couple of times per week, i receive emails notifications when files are available for processing. Currently i read these eamails with a java program and store the attachement on my C: drive and would now like to generate a PC script to send this file name up to UNIX-Solaris and... (3 Replies)
Discussion started by: bobk544
3 Replies

7. UNIX for Dummies Questions & Answers

Pc to unix ftp

Hello guys..I am new to Unix, I am trying to transfer a .txt file from my windows PC to my Unix account at school using ftp. I am kind of stuck, can anybody explain to me the steps to do this? (1 Reply)
Discussion started by: Aristo
1 Replies

8. Shell Programming and Scripting

FTP script for sending a file from one unix directory to another unix server director

Hi, My local server is :/usr/abcd/ Remote server is :/Usr/host/test/ I want to send files from local unix directory(All files starting with O_999) to remote host unix directory. Can any body give me the Unix Shell script to do this. One more doubt: Shall we need to change the file... (1 Reply)
Discussion started by: raja_1234
1 Replies

9. UNIX for Advanced & Expert Users

ftp from NT to UNIX

PROBLEM !!!!!!! I have files that is on a NT machine. It is located in a directory with subdirectories underneath it. TAR can not be used. I need to use a normal ftp command script to transfer these files from NT to UNIX, or get it from the UNIX machine, including the subdirectories. It must... (5 Replies)
Discussion started by: wolf
5 Replies

10. UNIX for Advanced & Expert Users

ftp from unix to pc

Hi All, How can I get a file as soon as generated into the unix server, it should get transferred into my pc? my pc connected to novell, and I know the ip address of my pc and unix server. reply to : ::email removed:: regards krishna (2 Replies)
Discussion started by: krishna
2 Replies
Login or Register to Ask a Question