I have a short list of files and directories of which I would like to make a flat copy of using ditto in a bash shell. There are approximately 8-10 files and/or directories that need to be copied. I know that I can just create a series of conditional statements such as:
if [ -d ~/Documents ];
ditto ~/Documents ~/BACKUP/Documents
echo "Documents copied successfully."
echo "WARNING: No documents were copied, directory does not exist in expected location."
However, I am curious if there is a stylistically better or more efficient way of accomplishing this task? Another approach that I have considered is creating an array that holds the files/directories and then using a loop to move through the array to copy each file. Thoughts? Ideas? Insights? Best practices?