I have a source directory S and destination directory D, and would like to move many files and folders from S to D at the same time. If the file in S is newer, then it should overwrite the file in D. However, no matter what, I want the files and folders in S to be deleted afterwards. Is there any way to do this? Basically, when I just copy from S to D and then blindly delete everything in S, I have no confidence that the process of copying didn't abruptly stop before it was finished- in which case deleting S would delete some required files.
Any suggestions would be greatly appreciated.