Project1

标题: rgss如何查找一个在其他位置的文件 [打印本页]

作者: pigsss    时间: 2011-3-8 20:20
标题: rgss如何查找一个在其他位置的文件
    require不能用……怨念dsu_plus_rewardpost_czw
作者: wsffx13    时间: 2011-3-9 00:34
不懂何意……自动搜索文件?有什么用?

只知道RM能判定文件是否存在 FileTest.exist?(文件路径)
作者: 苏小脉    时间: 2011-3-9 02:41
Dir 类里有不少接口可以用来进行与目录相关的操作:
http://ruby-doc.org/core/classes/Dir.html
比如 Dir.foreach 就可以迭代某目录下每一个文件的名字(如果是文件夹,可以进行递归),进行搜索。

要是图省事,也可以通过 MS-DOS 的 find 命令间接查找:
FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]

/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/OFF[LINE] Do not skip files with offline attribute set.
"string" Specifies the text string to find.
[drive:][path]filename
Specifies a file or files to search.





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1