Computing.Net > Forums > Unix > FTP files in an interval

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

FTP files in an interval

Reply to Message Icon

Name: ORIMON
Date: July 15, 2003 at 09:19:54 Pacific
OS: Unix Sun solaris
CPU/Ram: pentium iv
Comment:


Hi,
I am trying to FTP files ( say 100 files) one per minute.I am using the following
ftp -niv ${BOX} ENDOFTEXT
user xyz abcd
bin
pwd
mput *.txt
bye
ENDOFTEXT

where do i add ( sleep 60) so that i can ftp one file per minute?
Or is there any other idea to do the above?
Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: July 15, 2003 at 10:51:15 Pacific
Reply:

Put the ftp code as a function that is called once / minute. Pass as a parameter the name of the file you want to send within a for loop.


0

Response Number 2
Name: ORIMON
Date: July 15, 2003 at 14:29:13 Pacific
Reply:


David,
Thanks
but this will ask for multiple times of connecting , disconnecting and reconnecting..i do not want to do that for 500 times for 500 files.



0

Response Number 3
Name: WilliamRobertson
Date: July 15, 2003 at 16:02:59 Pacific
Reply:

You could try running it in background as a co-process. This would complicate things since you only have a basic text interface between the foreground process and the coprocess; but it does avoid having to reconnect each time you need ftp.


0

Response Number 4
Name: ORIMON
Date: July 16, 2003 at 07:26:48 Pacific
Reply:


Do i have any option of connecting to ftp only once and executing the for loop or sending the files one per one minute?
my options will be
1.if possible to call a script or use a forloop within that FTP connection
2.define a macro (macdef) to the above.
can anyone suggest..how to do that?

Thanks


0

Response Number 5
Name: WilliamRobertson
Date: July 16, 2003 at 10:50:54 Pacific
Reply:

ftp yourremotehost |&

# (assuming you have a .netrc file to automate
# login) the ftp session is now a co-process.

print -p ascii
print -p cd some/path

# Feed it commands via print -p

cd some/local/path

# You can execute other commands in the foreground.

for f in *.txt
do
print -p put $f
done

print -p bye

You can also use read -p to fetch output from the co-process, and there are some fancy redirection options in man ksh that I haven't properly experimented with.

The above is the ksh implementation: other shells probably have different ways of doing it.


0

Related Posts

See More



Response Number 6
Name: ORIMON
Date: July 16, 2003 at 12:52:40 Pacific
Reply:

Hi,
thats a wonderful idea.
but when ever i write print -p argument
its giving error
PRINT:Cannot open file: argument
do i need to change any configuartion /setup?
I am using ksh.
thanks


0

Response Number 7
Name: WilliamRobertson
Date: July 16, 2003 at 16:19:48 Pacific
Reply:

Never seen that. What does

whence -v print

do? It should report:

print is a shell builtin


0

Response Number 8
Name: ORIMON
Date: July 17, 2003 at 06:59:39 Pacific
Reply:

Here is what i got.

whence -v print
print is an exported alias for /apps/usr/bin/print

and i tried to open the print file....it was not readable....
please suggest.
Thnx


0

Response Number 9
Name: ORIMON
Date: July 17, 2003 at 08:57:23 Pacific
Reply:

Hey

i did the following..
unalias print

it worked for me.
Thanks a lot Williams.


0

Response Number 10
Name: WilliamRobertson
Date: July 17, 2003 at 09:13:30 Pacific
Reply:

Sounds like someone wrote a program with the same name as a standard shell command, which has to be asking for trouble.

Good to hear that worked anyway.


0

Response Number 11
Name: ORIMON
Date: July 31, 2003 at 07:17:08 Pacific
Reply:

badluck for me i have some other problem in this..i have to send say 500 files. but my FTP session is timed out after few minutes...
how do i mange that?...

my idea would be if i can catch with any flag..
if ftp timedout is true then reconnect to ftp...
but i am still inside ftp> how do i write a shell script?
please suggest.

Thanks


0

Sponsored Link
Ads by Google
Reply to Message Icon

cron/scp/expect Problem Insert line breaks in ASC...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: FTP files in an interval

FTP File Size Problem from UNIX to www.computing.net/answers/unix/ftp-file-size-problem-from-unix-to/4240.html

Delete all files in sub-dir +10 old www.computing.net/answers/unix/delete-all-files-in-subdir-10-old/7166.html

FTP Scripst in HP-UX www.computing.net/answers/unix/ftp-scripst-in-hpux/7009.html