China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-04 05:44
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] Batch file to back up files into a folder created with the current date as its name View 741 Replies 6
Original Poster Posted 2007-04-12 07:20 ·  中国 广东 深圳 龙岗区 电信
初级用户
Credits 28
Posts 11
Joined 2006-12-25 19:42
19-year member
UID 74546
Gender Male
Status Offline
Hello everyone, I just started learning to write batch files, and I ran into a problem,
Right now I want to write one
that automatically creates a folder named with the current date, and automatically copies files into that folder
Asking the experts for some guidance·!
Thanks in advance··
Floor 2 Posted 2007-04-12 07:50 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
echo %date:~0,10% and see what result you get? Then do MD and MOVE yourself
Floor 3 Posted 2007-04-12 08:51 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 866
Posts 415
Joined 2005-12-04 11:19
20-year member
UID 46459
Status Offline
Floor 4 Posted 2007-04-12 10:45 ·  中国 北京 鹏博士BGP
中级用户
★★
Credits 404
Posts 179
Joined 2006-03-30 14:44
20-year member
UID 53056
Status Offline
Floor 5 Posted 2007-04-12 23:12 ·  中国 广东 深圳 龙岗区 电信
初级用户
Credits 28
Posts 11
Joined 2006-12-25 19:42
19-year member
UID 74546
Gender Male
Status Offline
I tested md d:\%date:~0,10%
but no folder was created?
Floor 6 Posted 2007-04-13 00:38 ·  中国 广东 深圳 龙岗区 电信
初级用户
Credits 28
Posts 11
Joined 2006-12-25 19:42
19-year member
UID 74546
Gender Male
Status Offline
Just now I used
md d:\“%date:~0,10%”
to create a file, but the folders it created were d:\07\04\12 — the year, month, and day each became a separate folder
What I want is d:\070412
Please advise, experts
Floor 7 Posted 2007-04-13 00:41 ·  中国 广东 深圳 龙岗区 电信
初级用户
Credits 28
Posts 11
Joined 2006-12-25 19:42
19-year member
UID 74546
Gender Male
Status Offline
Problem solved. I changed the date format to 07-04-12 and then it worked
Forum Jump: