copy Files based on date

August 9, 2009 at 03:53:19
Specs: Windows XP, 2Gb
I need to copy MP3 files from one location to another based on the date of the file, in the file name.

I have files called something like


in one directory and each day i need to select the file for that day and copy is as another file name - that is the same every day - to another location.

So I need to scan directory A to find the fill file name for today and then copy (or XCOPY) the file to location B as say EM.mp3

xcopy EM090810.MP3 c:\em\em.mp3

Years ago I had a little com file that did this, but that was back in DOS5 days

See More: copy Files based on date

Report •

August 9, 2009 at 04:20:12
Can I take it that 090810 in the filename is the date in the format yymmdd ?

Do you have permissions/privileges to dl/install a small utility?

If not what is returned when you enter Echo %date% at the command prompt?

Report •

August 9, 2009 at 04:23:39
I have permissions ....full rights

echo %date% returns "sun 09/08/2009"


Report •

August 9, 2009 at 04:52:39
copy EM%date:~-2%%date:~7,2%%date:~4,2%.mp3 c:\em\em.mp3

If at first you don't succeed, you're about average.


Report •

Related Solutions

August 9, 2009 at 14:39:26
Mech2go has done the deed. I was gonna suggest you download DOFF from

It returns the date in many forms such as:

Doff dd                        returns the day only
Doff mm                       returns the month only
Doff yy                         returns the year only e.g. 08
Doff yyyy                      returns the year only e.g. 2008
Doff ddmmyy                returns the day month and year e.g. 231008
Doff mmddyyyy             returns the month day and year e.g. 10312008
Doff ddmmyyyy -30       returns today's date minus 30 days
Doff mmddyyyy +300    returns today's date plus 300 days

for /f %%# in ('doff yyyymmdd +10') do echo %%#

will return todays date +10 days in the format yyyymmdd

Report •

August 9, 2009 at 20:26:35
Thank you both for your solutions.

The copy date slicing works great.

I ahve also taken a look at the doff utillity and may use that in another case. By the way the DBX recover looks useful as my wife insistes on using Outlook Express with far too many emails stored.

Thanks Guys

Report •

Ask Question