Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2007-04-10
3
Medium Priority
?
577 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

604 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