FTP help


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP help
# 1  
Old 07-19-2009
FTP help

I need to FTP a file
from
LocalDir= 'cd orgs /"Financial Aid"/"MSS"/"0910"/"FTP" ';
to
CDRemoteDir="/u02/sct/banjobs";

The file in th local directory is created like 07130900.SUP the .SUP is always there, but the 07130900 (change everyday with the date, look at the format 07130900, how I can add code in this script, so I know that everyday is going to FTP the last file with the .SUP EXTENSION
Code:
#! /bin/sh
#
#**************************************************************************
# Script:  miis_ftp.ELM_SUP.shl
#
# Author:  
# Date: 7/17/2009
#
# Purpose:
#   
# files are downloaded from ELM,named xxxxxx00.SUP to 
 #  ="/u02/sct/banjobs";
#
# Directory Location for script:
#        #
# Special Notes:        This shell script is called from XXX
#                   run in job submission
#
#
# Modifications:
#  Date   Author          Description
#
# 
#
#**************************************************************************
#
FILE_NAME="$1";

MPATH=$BANNER_HOME;
ScriptName="miis_ftp.ELM_SUP.shl";

UpLoadFileName1=${FILE_NAME};
LocalDir= 'cd orgs /"Financial Aid"/"MSS"/"0910"/"FTP" ';
 
RemoteHost="middfiles.xxxx.edu";
###look at this
RemoteUser="XXXXX_finance";
RemotePass="XXXXXX+";
CDRemoteDir="/u02/sct/banjobs";

TMode="ascii";                          # Transfer mode

TodayDate=`date`;
echo "\nActivities for FTP proscess:";
#========================================================================================
# Change the directory to one contains the file to be transported
cd $LocalDir;

#----------------------------------------------------------------------------------------
# Initiate the FTP process
# Loop through remaining parameters to create ftp commands.
(
# Enter user-name and password in host machine
echo "user $RemoteUser $RemotePass"
# Set transfer mode
echo $TMode
# change remote directory
echo ${CDRemoteDir}
# Change local directory in local machine
##echo lcd $LocalDir


Last edited by vgersh99; 07-20-2009 at 01:14 PM.. Reason: code tags, PLEASE!
# 2  
Old 07-19-2009
You can get the date format in the way you specified using this:

Code:
date "+%m%d%y"

So you could set the filename like this:

Code:
FILENAME=`date "+%m%d%y"00.SUP`

# 3  
Old 07-19-2009
something like this?


Code:
ScriptName="miis_ftp.ELM_SUP.shl";
UpLoadFileName=`date "+%m%d%y"00.SUP`;
NewName= "eluppdtop.dat" ;

After I got the file, I need to change the name to eluppdtop.dat, is this correct

also
will this work, knowing that the file is in a directory in windows.. It is
going from a drirectory in windoxs to UNIX \

Code:
# Error Handling Function
function ErrorHandle
{ 
# if type is 1, then the file does not exist or unreadable
if [ $type -eq 1 ]
then
echo "File "$UpLoadFileName" does not exist or unreadable" >> $LogFile;
echo "Subject: Error in Running Script\n Error in uploading file script "$ScriptName". File "$UpLoadFileName" does not exist or unreadable" > EmailMessage;
sendmail -F " File Upload" $EmailAddress < EmailMessage;
rm EmailMessage;
fi
# if type is 2, then the file has zero size
if [ $type -eq 2 ]
then
echo "File "$UpLoadFileName" has a zero size value" >>$LogFile;
echo " Subject: Error in Running Script\n Error in uploading file script "$ScriptName". File "$UpLoadFileName" has a zero size value" > EmailMessage;
sendmail -F "The eluppdtop.dat File Upload" $EmailAddress < EmailMessage;
rm EmailMessage;
fi


Last edited by vgersh99; 07-20-2009 at 01:15 PM.. Reason: code tags, PLEASE!
# 4  
Old 07-20-2009
Once you have the file you can name it anything you wish. Also, it shouldn't be a problem that the FTP server is running on a Windows box.

Good luck
Login or Register to Ask a Question

Previous Thread | Next Thread

10 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. 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

4. 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

5. 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

6. 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

7. Shell Programming and Scripting

ftp script not able to connect to ftp server.

I have the following ftp script to get files from a remote location. However, on running the script I find that I am not even able to connect to ftp server. I am able to connect to ftp server using other GUI ftp tools like WS_FTP using the same IP. IP used here is a dummy IP. What can go... (3 Replies)
Discussion started by: gram77
3 Replies

8. 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

9. 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

10. Answers to Frequently Asked Questions

Automate FTP / Scripting FTP Transfers

One of our most frequent questions is how to automate ftp transfers. There are several approaches. Since I'm writing this post, we will start with my favorite technique. :) In Automated FTP task I present a simple example of my ksh co-process technique. And note that later in this thread I... (0 Replies)
Discussion started by: Perderabo
0 Replies
Login or Register to Ask a Question