I want to check if files count is 0 on Remote server using ssh.
Below code is only checking if file (ending with .dmp exists )
if ssh v0021x91 ls /apps/oracle/home/DB_1201/*.dmp then echo "Files still exist after cleanup" exit -9991 else echo "Files cleaned up" fi
For below "then" part is executed with ? != 0 ] then echo -e "[ERROR ] Can’t copy files from Source to Remote" exit -9995 fi if scp -rp /apps/oracle/home/DB_1201/*dmp [email protected]:/apps/oracle/home/DB_1201/ then echo -e "[INFO ] SCP Success" else echo -e "[ERROR ] Can’t copy files from Source to Remote" exit -9995 fi