frostrap 发表于 2022-7-6 17:30:40

仅返回vl文件系统时间

我被难住了。
 
下面的代码返回文件名,但对于每个文件的修改日期只返回nil。
 
这段代码只是一个简单的清除程序的构建块。在指定文件夹中放置一段时间后,从指定文件夹中删除bak文件。
 
你知道我为什么只把零还给我吗?
 
(defun Sbu(/ thefile thelist datemodified)
(vl-load-com)
(setq thelist (vl-directory-files "c:\\test\\" "*.*" 1))
(foreach thefile thelist
   (setq datemodified (vl-file-systime thefile))
   (print thefile)
   (print datemodified)
);foreach
(princ)
);defun
 
谢谢
 

wizman 发表于 2022-7-6 17:57:47

(定义Sbu(/thefile-thelist-datemodified)
(vl load com)
(setq目录“c:\\test\”)
(setq列表(vl目录文件目录“***”1))
(对于每个文件列表
(setq DATEMEDITED(vl file systime(strcat directory thefile)))
(打印文件)
(打印日期已修改)
) ;_ end\u foreach(结束)
(普林斯)
) ;_ end_defun(结束)

frostrap 发表于 2022-7-6 18:29:29

哦,我现在明白我的错误了。我引用了文件名,但省略了路径。
 
谢谢wizman!

wizman 发表于 2022-7-6 18:33:49

不客气,乔
页: [1]
查看完整版本: 仅返回vl文件系统时间