lua如何从全路径中获取文件名(linux、windows通用)

2025-03-26 03:04:20
推荐回答(3个)
回答1:

fn_flag = string.find(filename, "\\")if fn_flag thendest_filename = string.match(filename, ".+\\([^\\]*%.%w+)$")endfn_flag = string.find(filename, "/")if fn_flag thendest_filename = string.match(filename, ".+/([^/]*%.%w+)$")end更多详见 http://blog.csdn.net/bull_liu/article/details/8726089

回答2:

着急!!!
pcct_1.txt_20110120_20130704172172534.bak
pcct_1.txt_20110120_20130703172172534.bak
pcct_1.txt_20110120_20130905172172534.bak
pcct_1.txt_20110120_20130905272182534.bak
pcct_1.txt_20110120_20130703172172534.bak
......
要取其中一个文件的第21~28位中最大的那个文件.求指点.
不要那么复杂。怎么实现。

回答3:

可以用,十分感谢!