Count and Auto FTP


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Count and Auto FTP
# 1  
Old 05-29-2007
Error Count and Auto FTP

Hi, I really need to create a script that counts for file and ftp's them to a windows directory. !st problem i'm having is getting it to ftp withouty prompting me, i tried |& on the end of the ftp, but then it just hits a syntax error. 2nd problem is, i have to have a wildcard in this script. which is causing major trouble.

Is there anybody out there smarter then me, who can fix this?


#! /usr/bin/ksh

cd ????/????/par/942852
HOST=???.???.???.???
USER=USER
PASSWD=PWRD
count="$(find ????/????/par/942852/ -name "????*" -print | wc -l)"
if [[ $count -gt 0 ]]
then
exec 4>&1
ftp -nv >&4 2>&4
print -p open $???.???.???.???
print -p user $USER $PWRD
print -p cd \\???.???.???\WINDOWS\SYSTEM
print -p ascii
print -p mput ????*
print -p bye
wait
exit 0
else
exit 0
fi

cd ????/????/par/942852
mv ????* cd ????/????/par/942852/proc/
# 2  
Old 05-31-2007
Quote:
Originally Posted by dappa
Hi, I really need to create a script that counts for file and ftp's them to a windows directory. !st problem i'm having is getting it to ftp withouty prompting me, i tried |& on the end of the ftp, but then it just hits a syntax error. 2nd problem is, i have to have a wildcard in this script. which is causing major trouble.

Is there anybody out there smarter then me, who can fix this?


#! /usr/bin/ksh

cd ????/????/par/942852
HOST=???.???.???.???
USER=USER
PASSWD=PWRD
count="$(find ????/????/par/942852/ -name "????*" -print | wc -l)"
if [[ $count -gt 0 ]]
then
exec 4>&1
ftp -nv >&4 2>&4
print -p open $???.???.???.???
print -p user $USER $PWRD
print -p cd \\???.???.???\WINDOWS\SYSTEM
print -p ascii
print -p mput ????*
print -p bye
wait
exit 0
else
exit 0
fi

cd ????/????/par/942852
mv ????* cd ????/????/par/942852/proc/
Try this

ftp -v -n <<-EOF
open server
user user pass
bye
EOF
# 3  
Old 06-12-2007
Syntax error

And again i have a syntax error! There must be a way round this?




count=`ls /AUDDIS* | wc -l`

if [[ $count -gt 0 ]]
then
exec 4>&1
ftp -v -n <<-EOF
print -p open $???.???.???.???
user "user" "pwrd"
print -p cd \\???.???.???.???\????\Files\Auddis out
print -p ascii
print -p mput AUDDIS*.DAT_conv
print -p mput DDR*.DAT_conv
print -p bye
EOF
exit 0
else
exit 0
fi
# 4  
Old 06-13-2007
Quote:
Originally Posted by dappa
And again i have a syntax error! There must be a way round this?




count=`ls /AUDDIS* | wc -l`

if [[ $count -gt 0 ]]
then
exec 4>&1
ftp -v -n <<-EOF
print -p open $???.???.???.???
user "user" "pwrd"
print -p cd \\???.???.???.???\????\Files\Auddis out
print -p ascii
print -p mput AUDDIS*.DAT_conv
print -p mput DDR*.DAT_conv
print -p bye
EOF
exit 0
else
exit 0
fi
Why you use "print"? Remove it and try alone the commands
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Need HELP] Find aging file and auto FTP

Dear Experts, I have script to find aging file like this: find /ArchiveINTF/INTF name "*" -type f -mtime +365 {} \; >> agingfile.txt This script will find all files over 365 days. But, I have problem, how to auto FTP all files? Thanks Edy (3 Replies)
Discussion started by: edydsuranta
3 Replies

2. Shell Programming and Scripting

Auto Ftp pseudo random file

I have a script that generates a file which is my own incarnation of a date using the 'date' function (we'll call this script a). I would like that script to invoke my other script (script b) which contains my ftp info. Since I have yet to figure out a good way to use regular ftp (yes i can only... (6 Replies)
Discussion started by: DC Slick
6 Replies

3. Shell Programming and Scripting

bad argument count, tryig to FTP

I have a file in a Unix directory called 97210900.EFT I am getting this error: miis_ftp.ELM_EFT.shl: cd: bad argument count + + type=1 + ErrorHandle Here is the piece of code that is checking the file # Change the directory to one contains the file to be transported ##cd... (1 Reply)
Discussion started by: rechever
1 Replies

4. UNIX for Advanced & Expert Users

Count total file downloaded using FTP

Hi All, I'm developing a FTP script as below: ftp -v -n <IP_ADDRESS> << EOF user avery jSqaqUU2 lcd /directory/folder/ ascii prompt mget * bye EOF I would like to enhance the script to count the total file downloaded. For example, once the script run i want the message "Total <n>... (1 Reply)
Discussion started by: cas553
1 Replies

5. UNIX Desktop Questions & Answers

ftp-count files

How can I count files on ftp-site? I'm connecting thru ftp and I want to count files in my ftp-directory. Thanks. (1 Reply)
Discussion started by: gd2003
1 Replies

6. UNIX for Dummies Questions & Answers

find out the line count over FTP connection

I need help to find out the number of lines in a file which exists in remote machine. I the remote machine, auto login is enabled. So I do not need to worry about the username or password. But the problem is, I do not know how I can find out the line count once I get the FTP prompt. (1 Reply)
Discussion started by: Rita_questions
1 Replies

7. Shell Programming and Scripting

auto ftp the files

i have writen a shell to ftp a file automatically by taking the input from a file i have created on file tstftp as set timeout 120 ftp spawn ftp expect "ftp>" send "o 11.90.2.20 \r" expect "Name:" send "itcomxxl\r" expect "Password:" send "csms091206\r" expect "ftp>" send "prompt... (1 Reply)
Discussion started by: sasiprabu
1 Replies

8. Programming

Auto FTP from UNIX to Windows Server

Hi, I am a not strong programmer and now my boss ask me how should I do a job to automated FTP that have error check. I know about: * using system() to call a command to trigger ftp in C Coding. The senarios as follows: 1. FTP the file(s) (e.g ELA_20060407.dat) to a given LAN server... (1 Reply)
Discussion started by: songtam
1 Replies

9. Shell Programming and Scripting

Auto FTP to a server

Hi, I am trying to automate FTP login to a remote server and put a file there. But no matter what i do, It still is aksing me for the login and password although i have it defined in the variable. Could you tell me what is wrong with this script. I am doing this on SUN server. Pls... (11 Replies)
Discussion started by: systemali
11 Replies
Login or Register to Ask a Question