Trying to group about 374GB of data created over the last 9 years at C:\data into folders by year. Problem I have is that the xcopy /s/d:MM-DD-YYYY/y "/D"switch will grab all data on or after the date specified, and I cant seem to create a range to only grab say 01-01-2008 to 12-31-2008, so I have to have it perform a clean up after xcopying the data to the destination that will remove this newer data from the original source path so that the next xcopy routine can grab the next group of 01-01-2007 to 12-31-2007 data without passing the newer 2008 and 2009 data into the 2007 folder. ( Scratching my head on how to delete only this range of date/time stamped data after it is xcopied??? )
Below is an example of what I have so far, with explainations as to what I believe needs to happen in < > between each xcopy /s/d:MM-DD-YYYY/y routine.
Run from C:
xcopy c:\data\*.* c:\test1\2009\*.* /s/d:01-01-2009/y<delete 2009 data so that next routine doesnt pass 2009 data to 2008.
>
xcopy c:\data\*.* c:\test1\2008\*.* /s/d:01-01-2008/y<delete 2008 data so that next routine doesnt pass 2008 data to 2007.
>
xcopy c:\data\*.* c:\test1\2007\*.* /s/d:01-01-2007/y<delete 2007 data so that next routine doesnt pass 2007 data to 2006.
>
xcopy c:\data\*.* c:\test1\2006\*.* /s/d:01-01-2006/y<delete 2006 data so that next routine doesnt pass 2006 data to 2005.
>
xcopy c:\data\*.* c:\test1\2005\*.* /s/d:01-01-2005/y<delete 2005 data so that next routine doesnt pass 2005 data to 2004.
>
xcopy c:\data\*.* c:\test1\2004\*.* /s/d:01-01-2004/y<delete 2004 data so that next routine doesnt pass 2004 data to 2003.
>
xcopy c:\data\*.* c:\test1\2003\*.* /s/d:01-01-2003/y<delete 2003 data so that next routine doesnt pass 2003 data to 2002.
>
xcopy c:\data\*.* c:\test1\2002\*.* /s/d:01-01-2002/y<delete 2002 data so that next routine doesnt pass 2002 data to 2001.
>
xcopy c:\data\*.* c:\test1\2001\*.* /s/d:01-01-2001/y<delete 2001 data so that next routine doesnt pass 2001 data to 2000.
>
xcopy c:\data\*.* c:\test1\2000\*.* /s/d:01-01-2000/yrd dataThis rd data is the final clean up to remove c:\data after all data was moved into the grouped years with subdirectory data tree intact
Problem I have is how do you delete only data with date/time stamp of on say 01-01-2009 or after for each year to avoid the "/D:MM-DD-YYYY" passing newer data into what should be only the older specified directory path. I also want to keep the "/S" switch to maintain the directory path structure for data moved into the correct year of date/time stamp.
Any suggestions or code solutions vs the path I am taking with this project to group data by year?
I am guessing that there may be a better way and I am really butchering the purpose of the xcopy command by creating an individual instruction set for each year.
((OR)) can this be achieved without destroying the original C:\data source location to have the mixed data at c:\data and the sorted by year c:\test1\(year) locations by being able to set a date/time stamp range of 01-01-year to 12-31-year
((if free space permitted!))
Thanks for your help in advance to the solution that you provide to my coding madness ...