中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-12 05:15
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » [Help] How to determine which files in a directory have been modified
Printable Version  815 / 5
Floor1 bluesailer Posted 2009-07-02 04:51
新手上路 Posts 2 Credits 2
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?
Floor2 huahua0919 Posted 2009-07-02 04:58
银牌会员 Posts 780 Credits 1,608
You can use the DateLastModified property in VBS to determine it.
Floor3 bluesailer Posted 2009-07-02 05:20
新手上路 Posts 2 Credits 2
Could you give an example?
Thanks
Floor4 Hanyeguxing Posted 2009-07-02 05:49
银牌会员 Posts 897 Credits 1,039 From 在地狱中仰望天堂
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 ]
Floor5 ZJHJ Posted 2009-07-02 10:46
高级用户 Posts 374 Credits 609
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 ]
Floor6 bluewaterx Posted 2009-07-04 03:38
初级用户 Posts 68 Credits 132
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:
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023