Solved

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

Posted on 2007-04-10
3
542 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
  • 3
3 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Thanx!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Step by step guide to Clean and Sort your windows registry! Introduction: Always remember: A Clean registry = Better performance = Save your invaluable time In this article we're going to clear our registry manually! Yes, manually! The e…
If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 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

17 Experts available now in Live!

Get 1:1 Help Now