中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » DOS 下如何对指定时间段的文件操作.
作者:
标题: DOS 下如何对指定时间段的文件操作. 上一主题 | 下一主题
yzzhuu
新手上路





积分 4
发帖 1
注册 2009-6-20
状态 离线
『楼 主』:  DOS 下如何对指定时间段的文件操作.

想要把某个目录下(包含子目录)所有日期的修改时间为大于早七点三十分小于晚八点十五分的所有文件全部找出来并拷贝走或者全部删除也行,试了xcopy命令但只是支持天不支持小时分钟秒.

2009-6-20 23:12
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
DOSforever
金牌会员





积分 4633
发帖 2236
注册 2005-1-30
状态 离线
『第 2 楼』:  

介绍一个参数,这个参数差不多可以在所有以文件为操作对象的 4DOS 命令中使用

  Quote:

4DOS Help Topic:  Time Ranges


A time range specifies a file modification time without reference to the
date.  For example, to select files modified between noon and 2:00 pm on any
date, use /[t12:00p,2:00p].  The times in a time range can either be in
12-hour format, with a trailing "a" for AM or "p" for PM, or in 24-hour
format.

If you omit the second argument in a time range, you will select files that
were modified between the first time and the current time, on any date.  You
can also use offsets, beginning with a plus sign [+] or a minus sign [-] for
either or both of the arguments in a time range.  The offset values are
interpreted as minutes.  Some examples:

     Specification       Selects Files

     /[t12:00p,+120]     modified between noon and 2:00 PM on any date
     /[t-120,+120]       modified between two hours ago and the current
                         time on any date
     /[t0:00,11:59]      modified in the morning on any date

The standard FAT file system maintains a single time for each file,
reflecting the last time the file was written.  This is the time used by
4DOS on a FAT drive with no LFN support (e.g. under MS-DOS 6.22, PC DOS 7.0
or 2000, DR-DOS 7.03 without LONGNAME loaded, or OS/2).

Drives which support long filenames (e.g. under Windows 95/98/ME, or under
plain DOS with a suitable LFN driver loaded) maintain 3 sets of dates and
times for each file: creation, last access, and last write (for last access
only the date is recorded; the last access time is always returned as
00:00).  By default, time ranges work with the last write time stamp.  You
can use the "last access" (a) or "created" (c) time stamp in a time range
with the syntax:

     /[ta...]  or  /[tc...]

如按照你具体的需求:修改时间大于七点三十分小于晚八点十五分
可以这样

copy /s /[t7:30,20:15] ... ...

del /s /[t7:30,20:15] ...



DOS倒下了,但永远不死
DOS NEVER DIES !

投票调查:
http://www.cn-dos.net/forum/viewthread.php?tid=46187

本人尚未解决的疑难问题:
http://www.cn-dos.net/forum/viewthread.php?tid=15135
http://www.cn-dos.net/forum/viewthread.php?tid=47663
http://www.cn-dos.net/forum/viewthread.php?tid=48747
2009-6-28 10:07
查看资料  发短消息 网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: