查看: 1941|回复: 2

[已经解决] rgss如何查找一个在其他位置的文件

  [复制链接]
梦石
0
星屑
1691
在线时间
2205 小时
注册时间
2010-6-27
回帖
1259
发表于 2011-3-8 20:20:18 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
    require不能用……怨念

于是我也广告下…
梦石
0
星屑
202
在线时间
498 小时
注册时间
2006-10-21
回帖
859
发表于 2011-3-9 00:34:07 | 显示全部楼层
不懂何意……自动搜索文件?有什么用?

只知道RM能判定文件是否存在 FileTest.exist?(文件路径)

点评

邪恶的作用。  发表于 2011-3-9 07:59
回复

使用道具 举报

梦石
0
星屑
310
在线时间
953 小时
注册时间
2007-4-25
回帖
798
发表于 2011-3-9 02:41:05 | 显示全部楼层
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.
su@rpg.blue:~> repeat 1 fortune
Matz is nice, so we are nice.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部