how to rollback copy of files from SOURCE to DESTINATION? Let me give examples based on Magento (but it does not matter).
When I install a new module, I get a zip file, I extract it in a temporary folder like c:\temp\my_new_module
I have a bunch of directories and files extracted there, from the zip. Some of the directories map Magento directories, some are new directories.
Then I copy files from the main path (c:\temp\my_new_module) to magento root path (c:\magento)
Let's say I test the module few days later, and I don't like it, how can I rollback DESTINATION? ie, how to remove from DESTINATION=c:\magento:
- new directories with new files from c:\magento (that were copied from SOURCE)
- new files added to existing Magento directories
It means I want to preserve files and folders in DESTINATION that were already there before the copy paste! I don't want to touch anything from SOURCE (neither remove or whatever).
I'm looking for a script to do that (command line), I guess it would compare SOURCE and DESTINATION.
For Each File from SOURCE
if FILE_EXIST in DESTINATION
Then DELETE FILE From DESTINATION
If DIRECTORY_IS_EMPTY in DESTINATION
THEN DELETE DIRECTORY in DESTINATION
(the latter will preserver non-empty directories, ie the one that were created before the copy)
thanks for any help, Rod