Hi i am using a shell script for renaming the files and placing in the remote location(FTP) my code is:
cd $1
day=$(date +%d)
for i in `ls -1 BBW*`
do
last=`tail -1 $i`
pat=`expr "$last" : '.*(\(.*\)).'`
pat=`echo $pat | sed 's/ //'`
pat=$pat$day
mv $i $pat
rm -f $day
done
#!/usr/bin/sh
ftp -v -n "$2" << cmd
user "$3" "$4"
cd $5
mput *
bye
cmd
pwd
exit
and parameters(arguments) are
$1(FilePath)=/data/customer/Personal/na
$2(IPAddress)=123.369.45.65
$3(Username)=xvxvxvx
$4(pASSWORD)=*****
$5(FilePath)=/data/man/sub
this is giving output
Requriment:
And also i want to check the file paths are valid paths($1,$5) please tell how to change the script for checking the valid paths.if the filepaths are find invalid i want to stop the executing the script.please give some modification code to check the file paths are valid.