I'm creating a simple script that copies all files from DIRECTORYA that do not exist in DIRECTORYB. I'm doing this through the use of the cp command:
cp -u DIRECTORYA/* DIRECTORYB
What I'd like to do is also send an email to an administrator that will list the files that have been copied.
So ideally, before I run the above command, I'd like to get the files that will be copied and store them in a variable for later use when building my email message.
Can anybody point me in the right direction? I've looked into using grep but I don't think this can be done with the cp command?