Parameter of batch file about copying file with date format YYYYMMDD

By man_simon ·
Dear All,

I have difficulty about copy file from one location to another by using xcopy or robocopy.
Below my case

Source files that with current date format specified, i.e abc-yyyymmdd.txt:

Let's say current date is 11/07/2009, if i want to copy previous date created file(abc-20090710.txt) to another location, how can i set/define the related parameter? It is possible to use robocopy or xcopy?

i has searched online for a long time. Hope someone can help me.

Many Thanks x 1000000

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
Thread display: Collapse - | Expand +

All Answers

Collapse -

we had similar need

by Slayer_ In reply to Parameter of batch file a ...

We ended up writing a VB6 app to do it.

Collapse -

Date in batch files

by Churdoo In reply to Parameter of batch file a ...

The following code in a batch file will set environment variables based on today's date which you can use to create the new filename:

Set mm=%DATE:~4,2%
Set dd=%DATE:~7,2%
Set yyyy=%DATE:~10,4%

You can then concatenate %yyyy%+%mm%+%dd% in a batch file to create your new filename with today's date.

Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums