ftp concern


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ftp concern
# 1  
Old 09-01-2011
ftp concern

Good Day,

I am new to scripting and i am creating this ftp script which would transfer files from a certain directory (directorydd), but i want to let the user input a specific date for that directory:

my script is:
Code:
#ftp
#!/bin/ksh
set -x

echo "Enter date <dd>:"
read a

ftp -vin 10.131.3.94 << "EOF" 
#open 10.x.x.132
user ryan xxxxxx

cd /home/ryan/sample/aug${a}/part # not changing directory
mget dataaug2011.txt

bye
EOF

Upon running script
Code:
$ sh sample.sh
+ echo Enter date <dd>:
Enter date <dd>:
+ read a
31
+ ftp -vin 10.x.x.x
+ 0< /tmp/sh27865154.2
Connected to 10.x.x.x.
220 testserver FTP server (Revision 1.1 Version wuftpd-2.6.1(PHNE_34698) Fri Nov 10 10:21:03 GMT 2006) ready.
?Invalid command
331 Password required for ryan.
230 User ryan logged in.
550 /home/ryan/sampe/aug${a}/part: No such file or directory.
dataaug2011.txt: No such file or directory.
can't find list of remote files, oops
221-You have transferred 0 bytes in 0 files.
221-Total traffic for this session was 516 bytes in 0 transfers.
221-Thank you for using the FTP service on testserver.
221 Goodbye.

your help would be highly appreciated.

thank you.

Last edited by Scott; 09-01-2011 at 06:18 PM.. Reason: Code tags
# 2  
Old 09-01-2011
Usually, one asks up front, validates the answer, and then writes the whole ftp script with this variable embedded where desired. If the date is related to the usual run time, then a default can be generated usig `date '+%...'`.
# 3  
Old 09-01-2011
hi the date of the folder created is minus 1 of the current system date..i tried using the date command but to no avail Smilie
# 4  
Old 09-01-2011
Do you have gnu/linux 'date'? The originals lacked offsetting.

--date=STRING is a mostly free format human readable date string such as "Sun, 29 Feb 2004 16:21:42 -0800" or "2004-02-29 16:21:42" or even "next Thursday".

Code:
date --date=yesterday '+%d'

This User Gave Thanks to DGPickett For This Post:
# 5  
Old 09-01-2011
yes i do have..i'll give this one a try..thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Solaris

FTP log only shows FTP LOGIN FROM entry?

OS: Solaris 9 Configuration /etc/syslog.conf daemon.debug /etc/inetd.conf ftp stream tcp6 nowait root /usr/sbin/in.ftpd in.ftpd -A -l -d Found the ftp.log only generate those entries from other servers/hosts. Can we trace on all ftp entries either from/to the server? ... (6 Replies)
Discussion started by: KhawHL
6 Replies

2. HP-UX

[Solved] Unable to rename file in ftp server .Net:FTP perl

Hello All, I am trying to connect to ftp server and get the files. Also i need to rename the file in other ftp dir. rename method is not allowing me to rename the file in other dir. When i tried copy command by using net::FTP:FILE then perl says it is not installed. Can some body help me to... (2 Replies)
Discussion started by: krsnadasa
2 Replies

3. Programming

GTK C development; question/concern wrt gtk_dialog_run

I'm new to GTK development, so I've been going through the examples just to capture the basics. I've done a lot of Unix GUI development before, but it was all Xt/Motif stuff. So, the GTK scheduler is something new to me. That said, I was going through the color selection example here, and was... (8 Replies)
Discussion started by: DreamWarrior
8 Replies

4. AIX

ftp connect in passive mode , ftp settings

how to connect to ftp server in passive mode? ftp server.abc and how can i see ftp settings, doesn't exist some ftpd.conf there is some other file where i check the options and configurations of ftp server? Thanks (3 Replies)
Discussion started by: prpkrk
3 Replies

5. Shell Programming and Scripting

Automated FTP script using .netrc to multiple FTP servers

Hi all, I'm using the following script to automated ftp files to 1 ftp servers host=192.168.0.1 /usr/bin/ftp -vi >> $bkplog 2>&1 <<ftp open $host bin cd ${directory} put $files quit ftp and the .netrc file contain machine 192.168.0.1 login abc... (4 Replies)
Discussion started by: varu0612
4 Replies

6. Shell Programming and Scripting

passing parameter to ftp script from output of another ftp

Hi, I have a ftp script which first gets all the file names and echo's the latest file. I'm using another ftp command sets to get the file name given by first ftp. The problem is the parameter is not accepted by second ftp. The error message i'm getting is > Rename Temp File calloc:ICMP... (5 Replies)
Discussion started by: ammu
5 Replies

7. UNIX for Advanced & Expert Users

Using FTP to check whether file is completely FTP... plz find the description below

Hi, We have some clients who will place huge files in to one of the remote server. And the shell script written in our local server to retrieve client files (using FTP) placed on one of the remote server of ours by clients. My question Is there any FTP command/script to check from my local... (1 Reply)
Discussion started by: nmsrao
1 Replies

8. 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
Login or Register to Ask a Question