Solved

Attach todays date to a destination file's name in the COPY command

Posted on 2013-10-24
2
340 Views
Last Modified: 2013-10-24
copy P:\RCA-Self Pay\SP_Data\RCAHdr.csv + P:\RCA-Self Pay\SP_Data\RCA.csv P:\RCA-Self Pay\SP_Data\RCAData.txt

What can I add to the destination file name to put today's date in the format "YYYYMMDD" programatically?

Thanks

Glen
0
Comment
Question by:GPSPOW
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
lindento earned 500 total points
ID: 39599185
Hi,

echo %date:~10,4%%date:~7,2%%date:~4,2%

will output the date as you requested but you might need to adjust the string location according to your local settings, on my system
Z:\>date /T
Fri 25/10/2013

so i grep out of this string starting from the 10 position next 4 characters which are 2013
and output it and so on.

So your copy command would look like this:

copy P:\RCA-Self Pay\SP_Data\RCAHdr.csv + P:\RCA-Self Pay\SP_Data\RCA.csv P:\RCA-Self Pay\SP_Data\RCAData%date:~10,4%%date:~7,2%%date:~4,2%.txt
which would add the date to the destination file.

Best Regards
0
 

Author Closing Comment

by:GPSPOW
ID: 39599194
Thanks

That did it.

Glen
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had a hard drive that you can't boot into, but need to change the registry? Here is the solution! This article guides you through accessing and editing a registry of a non-primary drive. To read registry information on a non-prim…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question