Solved

Create files named (YYMMDD.txt) with batch file !!

Posted on 2007-04-10
3
557 Views
Last Modified: 2010-04-18
Hi

How Can I create batch file do the following operation ??

I have this file (C:\Database.txt) it’s dally created in the same location

I need to copy this file every day after I double click the batch file to new location with new file name format
C:\backup\070410.txt
C:\backup\070411.txt
C:\backup\070412.txt
C:\backup\070413.txt

As you can see the it’s in this format (YYMMDD.txt)

So how Can I create batch file can copy file to new location with new file name format ??

Thanks with my regarding
0
Comment
Question by:Fraas
[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
  • 3
3 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 18881421
set year=%date:~12%
set month=%date:~4.2%
set day=%date:~7,2%
copy c:\database.txt c:\backup\%year%%month%%day%.txt
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18881435
Or, if you wanted the full year, you could do it this way:

for /f "tokens=2-3* delims=/ " %%a in ("%date%") do copy c:\database.txt c:\backup\%%c%%a%%b
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18883456
Thanx!
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 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