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-12 06:13
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] How to determine which files in a directory have been modified View 816 Replies 5
Original Poster Posted 2009-07-02 04:51 ·  中国 香港
新手上路
Credits 2
Posts 2
Joined 2009-07-01 02:37
17-year member
UID 148472
Gender Male
Status Offline
There is a folder on the server, and I need to use a script or batch command to check which files have been modified by someone.
How should this be done, experts?
Floor 2 Posted 2009-07-02 04:58 ·  中国 江苏 苏州 电信
银牌会员
★★★
Credits 1,608
Posts 780
Joined 2007-10-07 10:19
18-year member
UID 99089
Gender Male
Status Offline
You can use the DateLastModified property in VBS to determine it.
Floor 3 Posted 2009-07-02 05:20 ·  中国 香港
新手上路
Credits 2
Posts 2
Joined 2009-07-01 02:37
17-year member
UID 148472
Gender Male
Status Offline
Could you give an example?
Thanks
Floor 4 Posted 2009-07-02 05:49 ·  中国 吉林 延边朝鲜族自治州 延吉市 电信
银牌会员
★★★
正在学习中的菜鸟...
Credits 1,039
Posts 897
Joined 2009-03-01 15:34
17-year member
UID 140302
Gender Male
From 在地狱中仰望天堂
Status Offline
In batch processing:
%~t1 expands %1 to the file date/time. This time is the last modified time.
The creation time can be seen with dir /a /t:c.


So, depending on the situation, you can output the creation time or last modified time of all files in the folder, and then compare them when needed. But the creation time or modified time of files or folders can be tampered with, so this method is not very reliable.

A more precise way is to use an md5 tool to generate md5 values for all files, and then compare whether the md5 values have changed when needed, in order to determine whether they have been modified. Of course, there is also a lot of specialized file read/write monitoring software on the Internet. . . .

[ Last edited by Hanyeguxing on 2009-7-2 at 05:55 ]
Floor 5 Posted 2009-07-02 10:46 ·  中国 四川 泸州 联通
高级用户
★★★
Credits 609
Posts 374
Joined 2006-08-02 22:38
20-year member
UID 59720
Status Offline
You can record the files by modification time as a backup, and compare them with the next recorded set.
(Because if any file is modified, its modification time and file size will definitely be changed.)
If the files are relatively large, that is, if there are many lines, then the difficult part is comparing the two files.
If you........really have trouble.....you can refer to the exe, dll, inf program snapshot comparison (checking whether they were modified by a virus) in Computer System Maintenance
http://www.cn-dos.net/forum/viewthread.php?tid=46354&fpage=1

[ Last edited by ZJHJ on 2009-7-2 at 11:02 ]
Floor 6 Posted 2009-07-04 03:38 ·  中国 吉林 长春 电信
初级用户
★★
Credits 132
Posts 68
Joined 2008-07-29 20:51
18-year member
UID 122345
Gender Male
Status Offline
I made one in DOS to detect all changed files under drive C:, using the fc command to compare the file lists from before and after

crea old ↓ cls old ↓ see a~g ↓ SYS a~g
Create original list ↓ Clear original list ↓ View all result sets↓ View SYS type set

crea new ↓ cls new ↓ exe a~g ↓ ... a~g
Create comparison list ↓ Clear comparison list ↓ View EXE type set ↓ View custom set

fc a~g a~g ↓ cls result ↓ dll a~g ↓ menu
Compare result sets ↓ Clear result set ↓ View DLL type set ↓ Return to main menu
────────────────────────────────────

[Original List] [Comparison List] [Result Set]
╭──────────────────────────────────╮
│ [A]----------------------------[ ]----------------------------[ ] │
│ [ ]----------------------------[ ]----------------------------[ ] │
│ [ ]----------------------------[ ]----------------------------[ ] │
│ [ ]----------------------------[ ]----------------------------[ ] │
│ [ ]----------------------------[ ]----------------------------[ ] │
│ [ ]----------------------------[ ]----------------------------[ ] │
│ [ ]----------------------------[ ]----------------------------[ ] │
╰──────────────────────────────────╯
[Time of last creation of the original list: 2009-06-26 Friday 11:54:23.85]


Command:
Forum Jump: