I have created a batch which will copy the contents(sub folders and files) of an existing folder with a specific name (folder name : "BackupFrom")from c:\ drive and create a new folder with a prefix "SampleRetentionBackup" followed by the date time stamp in "yyyy_mm_dd" format like "SampleRetentionBackup_2018_11_28". After, copying i am looking for the same folder SampleRetentionBackup_2018_11_28" which are 1 days old and moving that folder(s) alone to a new folder in d:\Archive where the Archive folder is created on the fly and move the folders which starts with "SampleRetentionBackup". So far it is working fine. But the only issue is instead of moving the folder which are x days old("SampleRetentionBackup_2018_11_28"), it is moving the recent folder ("SampleRetentionBackup_2018_12_07")to the archive folder in d:\drive. I need some help.
Please find the batch file scripting below:
robocopy C:\BackupFrom %source% *.* /S
if not exist d:\Archive\%destination% mkdir d:\Archive\%destination%
robocopy %source% /s /e /minage:2 /move d:\Archive\%destination%