Hello,
I have a script in ksh which will check the difference within two or more files in a different directory. How can I add at the beginig of this function or maybe earlier, the possibility to check if they are multiple files in the same directory and if yes, make a diff between those files ?
This is my function:
function TransfertPaiements
{
# Parameters:
# $1 Caisse
# $2 Alias FTP
# $3 File name
#
echo "`date +'%d%m%Y-%H:%M'` - TT PP $1 " >> $CURRLOGFILE
for file in `ls $RootFTPSrv/$2`
do
[ -f $OFACPOOLPP101/BACKUP/`basename $file` ]
if [[ $? -eq 0 ]]
then
diff $file $OFACPOOLPP101/BACKUP/`basename $file`
if [[ $? -eq 0 ]]
then
echo "File alredy done" >>$CURRLOGFILE
mv $file $OFACPOOLPP101/OLD/`basename $file`
(echo "SUBJECT : File $file already done from `date +'%d%m%y-%H:%M:%S'`"
cat $CURRLOGFILE) | /usr/lib/sendmail xxx@xxx.ch
fi
fi
done
I have a script in ksh which will check the difference within two or more files in a different directory. How can I add at the beginig of this function or maybe earlier, the possibility to check if they are multiple files in the same directory and if yes, make a diff between those files ?
This is my function:
function TransfertPaiements
{
# Parameters:
# $1 Caisse
# $2 Alias FTP
# $3 File name
#
echo "`date +'%d%m%Y-%H:%M'` - TT PP $1 " >> $CURRLOGFILE
for file in `ls $RootFTPSrv/$2`
do
[ -f $OFACPOOLPP101/BACKUP/`basename $file` ]
if [[ $? -eq 0 ]]
then
diff $file $OFACPOOLPP101/BACKUP/`basename $file`
if [[ $? -eq 0 ]]
then
echo "File alredy done" >>$CURRLOGFILE
mv $file $OFACPOOLPP101/OLD/`basename $file`
(echo "SUBJECT : File $file already done from `date +'%d%m%y-%H:%M:%S'`"
cat $CURRLOGFILE) | /usr/lib/sendmail xxx@xxx.ch
fi
fi
done