Difference between revisions of "Fs.find"

From ComputerCraft Wiki
Jump to: navigation, search
(Created fs.find page)
 
m
 
Line 5: Line 5:
 
|api=fs
 
|api=fs
 
|returns={{Type|table}} list of files and folders on the computer that matches the search term.
 
|returns={{Type|table}} list of files and folders on the computer that matches the search term.
|desc=Returns a list of all the files and folders that match a wildcard expansion search.
+
|desc=Returns a list of all the files and folders that match a wildcard expansion search. '''''Requires version 1.6 or later.'''
 
|examples=
 
|examples=
 
{{Example
 
{{Example
 
|desc=Lists all files containing 'gps' in the subfolders of the 'rom' folder.
 
|desc=Lists all files containing 'gps' in the subfolders of the 'rom' folder.
|code=print(textutils.seralize(fs.find("/rom/*/gps")))
+
|code=[[print]]([[textutils.serialize]]('''fs.find("/rom/*/gps")'''))
|output={"rom/apis/gps", "rom/help/gps", "rom/programs/gps"}
+
|output={"rom/apis/gps",<br>"rom/help/gps",<br>"rom/programs/gps"}
 
}}
 
}}
 
}}
 
}}
  
 
[[Category:Lua_Core_Functions]]
 
[[Category:Lua_Core_Functions]]

Latest revision as of 21:38, 16 April 2014


Grid Redstone.png  Function fs.find
Returns a list of all the files and folders that match a wildcard expansion search. Requires version 1.6 or later.
Syntax fs.find(string wildcard)
Returns table list of files and folders on the computer that matches the search term.
Part of ComputerCraft
API fs

Examples

Grid paper.png  Example
Lists all files containing 'gps' in the subfolders of the 'rom' folder.
Code
print(textutils.serialize(fs.find("/rom/*/gps")))
Output {"rom/apis/gps",
"rom/help/gps",
"rom/programs/gps"}