Solved

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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

839 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