Solved

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

Posted on 2013-10-24
2
325 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Many admins will agree: WSUS is is a nice invention but using it on the client side when updating a newly installed computer is still time consuming as you have to do several reboots and furthermore, the procedure of installing updates, rebooting an…
Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
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…

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now