Does not exist or unreadable error in windows ftp script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Does not exist or unreadable error in windows ftp script
# 1  
Old 07-20-2009
Does not exist or unreadable error in windows ftp script

I have a file like this 07200900.SUP,in a windows directory I need to FTP this file to UNIX , the directory in unix is N:\orgs\Financial Aid\MIIS\0910\FTP
I am getting this error
miis_ftp.ELM_SUP.shl[30]: =cd orgs/"Financial Aid"/"MIIS"/"0910"/"FTP" : not found
IN THE LOG FILE
Activities for Mon Jul 20 16:44:05 EDT 2009:
File 07200900.SUP does not exist or unreadable
End of activities


Code:
#MPATH="/u02/sct/banner/banpntr";
MPATH=$BANNER_HOME;
JOBNUM=$ONE_UP;
USER=$BANUID;
LPATH="/u02/sct/banjobs/";
$CDRemoteDir='cd orgs/"Financial Aid"/"MIIS"/"0910"/"FTP" ';
ScriptName="miis_ftp.ELM_SUP.shl";
UpLoadFileName=`date "+%m%d%y"00.SUP`;
##NewName= "eluppdtop.dat" ;


RemoteHost="middfiles.XXXXX.edu";
### look at this
RemoteUser="XXXXXX_finaid";
RemotePass="XXXXX";
###CDRemoteDir= "/u02/sct/banjobs";
TMode="ascii"; # Transfer mode
EmailAddress="XXXXX@XXXXXX.edu";
LogFileName="miis_ftp.ELM_SUP_${USER}_${JOBNUM}.log";
LogFile="${LPATH}${LogFileName}";
 TodayDate=`date`;
echo "\nActivities for "$TodayDate":" >> $LogFile;
#========================================================================#
# 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
    echo "End of activities\n" >> $LogFile
# Exit the program since error occurred
exit 1;
}
#========================================================================#
# Change the directory to one contains the file to be transported
##cd $LocalDir;
 cd  $CDRemoteDir;
# Do an -r command on the desired file ensure that the file exist and readable
if [ ! -r $UpLoadFileName ]
then
        type="1";
        ErrorHandle;
fi
# Do an -s command on the desired file ensure that the file exist
# and is not null
if [ ! -s $UpLoadFileName ]
then
        type="2";
        ErrorHandle;
fi

#========================================================================#
# 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 directory in host machine
echo ${CDRemoteDir}
# Change local directory in local machine
echo lcd $LocalDir
# Transfer original file name
echo put $UpLoadFileName
# End ftp session
echo quit
) | ftp -vin $RemoteHost >> $LogFile
# End of FTP Process
#========================================================================#


Last edited by rechever; 07-20-2009 at 06:15 PM..
# 2  
Old 07-20-2009
First N:\orgs\Financial Aid\MIIS\0910\FTP is not a UNIX directory. It is a windows directory. Is it mounted as an NFS drive maybe. Next you are using

Code:
 
cd orgs/"Financial Aid"/"MIIS"/"0910"/"FTP"

You need to put the full pathname to the orgs directory or where N: is pointing too. For example N: may be /home/test on UNIX mounted as NFS. Then you would

Code:
 
 cd  /home/test/orgs/"Financial Aid"/"MIIS"/"0910"/"FTP"

# 3  
Old 07-20-2009
I try that, it does not work

it is a remote host RemoteHost="middfiles.XXXXX.edu";

Network connection: middfiles.xxxxx.edu

xxx( I changed to xxxx)
Code:
$CDRemoteDir='cd orgs/"Financial Aid"/"MIIS"/"0910"/"FTP" ';
ScriptName="miis_ftp.ELM_SUP.shl";
UpLoadFileName=`date "+%m%d%y"00.SUP`;
##NewName= "eluppdtop.dat" ;


Last edited by Yogesh Sawant; 07-21-2009 at 04:04 AM.. Reason: added code tags
# 4  
Old 07-21-2009
So did you manually do what the sciprt is doing. FTP to "middfiles.XXXXX.edu", login, and then manually cd to that directory? If not see what directory you are in by doing an pwd or ls. Then determine what path needs to be keyed in to get to the orgs directory.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Isql and If Exist syntax error in UNIX script

Hello Everyone, Coming again for your help to solve the below error: In a script, i had created a temp table (Temp_table) and loaded the data in it using bcp command (performed successfully) and I wanted to move it to the preferred table (called Main_table) for further use. hence I have added... (7 Replies)
Discussion started by: Suresh
7 Replies

2. UNIX for Advanced & Expert Users

ftp in shell script from linux to windows XP

Hi, I have 9 different linux based servers and i am automating there healthcheckup by doing ssh and fetching deviations out of it in a single text file. I am doing so by using ssh keygen. I am done with the above part . Now i want to ftp that text file to my windows XP desktop and i want to... (4 Replies)
Discussion started by: gemnian.g
4 Replies

3. UNIX for Advanced & Expert Users

Shell script to ftp files from windows to unix

Hi , I need to ftp some input files from windows to unix server.All the files will be saved in the C drive in my machine.Currently all these files are transferring manually to the unix server.I need to write a shell script which ftp the files from windows to unix box.When I searched in the forum i... (1 Reply)
Discussion started by: kavithakuttyk
1 Replies

4. Shell Programming and Scripting

file does not exist or unreadable in an FTP script

I will appreciate any help with this... I have a file in this directory that looks like: this 07210900.SUP, I am getting the following error: Activities for Tue Jul 21 07:29:14 EDT 2009: File 07210900.SUP does not exist or unreadable End of activities The idea is to capture the file in... (1 Reply)
Discussion started by: rechever
1 Replies

5. Shell Programming and Scripting

FTP from unix shell script to windows

Hi, I m trying to connect/establish FTP from unix shell script to my PC.Below the script i have written #!/bin/ksh ftp -v -n ddcappip01.com << "EOF" user Amit jason bye EOF ------------------------------ERROR-------------------------- but i m getting the below error for the... (4 Replies)
Discussion started by: ali560045
4 Replies

6. UNIX for Advanced & Expert Users

Executing shell script from Windows FTP

Hello, Any inputs on the possibility of executing a shell script on unix box from Windows FTP TIA (1 Reply)
Discussion started by: B2BIntegrator
1 Replies

7. Shell Programming and Scripting

FTP from Linux to windows server by shell script

Hi, Please advice whether my below requirement is feasible, My requirement : Automated FTP from linux server to windows server using a shell script on every monday. If feasible, please help me how to do this ? Thanks in advance (2 Replies)
Discussion started by: apsprabhu
2 Replies

8. Shell Programming and Scripting

Shell Script to ftp from windows server

Hello All, I've to write a shell script to transfer some files to/from windows server. I can put & get files simply by doing ftp but need to automate this. So I tried for this -. HOST=.hostname USER='username' PASSWD='***' ftp -n $HOST <<END_SCRIPT quote USER $USER quote PASS... (8 Replies)
Discussion started by: shilpa.rajput
8 Replies

9. Shell Programming and Scripting

FTP Unix Box to Windows Shell Script

Hello All, Could someone help me out with this? I want to incorporate this into an existing script so the output of a SAS job can be ftp'd from our UNIX box to a directory on a drive in Windows environment. Can this be done with no extra third party software? We currently use Putty for copy... (2 Replies)
Discussion started by: Jose Miguel
2 Replies

10. Shell Programming and Scripting

Automatic FTP Script from windows to unix machine

Hi i need to FTP files from windows to unix(sun) machine using script. what are the scripts commands i need to use to transfer files Thanks (2 Replies)
Discussion started by: bmkreddy
2 Replies
Login or Register to Ask a Question