Hi Experts,
I am beginner to shell scripting, I have a archive script which will connect to the FTP server and archive the files from FTP source location to FTP archive location.
Now the problem here is, the script working for few files and not working for few.I am facing the below error (Files are in use or locked).My question is how to check whether the files are in USE or LOCKED? and if they are locked or in use, how to remove
HOST='xxxx'
USER='xxxx'
PASSWD='xxxx'
PORTNO='9999'
FILE_NAME=$1
FTP_SRC_PATH=$2
FTP_ARC_PATH=$3
CURR_PATH=`pwd`
#CURR_PATH='/Product/Asset/Source'
ftp -n $HOST $PORTNO <<ENDfilelst
cd $FTP_SRC_PATH
quote USER $USER
quote PASS $PASSWD
bin
prompt
lcd $CURR_PATH
cd $FTP_SRC_PATH
ls $FILE_NAME archivefilelist.txt
quit
ENDfilelst
cat archivefilelist.txt
cat archivefilelist.txt | rev | cut -d' ' -f1 | rev > tempfile
mv tempfile archivefilelist.txt
while read line
do
ftp -n $HOST $PORTNO <<ENDfilelst
quote USER $USER
quote PASS $PASSWD
bin
prompt
lcd $CURR_PATH
rename $FTP_SRC_PATH/$line $FTP_ARC_PATH/$line
quit
ENDfilelst
done < archivefilelist.txt
Error Line:
+ mv tempfile archivefilelist.txt
+ read line
+ ftp -n wmx-mft-test.xxxx.com 8121
Interactive mode off.
Local directory now /var/local/ei/etl/Scripts
File rename error. (bad path? in use? locked?)
+ read line
+ rm archivefilelist.txt