How can I copy a directory and rename it in the same command?
You should be able to do just
cp -R /tf/Custom_App /tf/Custom_App_backups/Custom_App_2017-12-21
However, if the target directory already exists, this would append the final part of the source path to the destination path, creating
/tf/Custom_App_backups/Custom_App_2017-12-21/Custom_App
, and then copy the rest of the tree within that.
To prevent this, use /tf/Custom_App/.
as the source. Of course, in that case you might want to rm -r /tf/Custom_App_backups/Custom_App_2017-12-21
first, if you don't want older files lying around there after the copy.
The difference between /some/dir
and /some/dir/.
was discussed a while back in cp behaves weirdly when . (dot) or .. (dot dot) are the source directory