Advertisement
1lann

locate

Nov 15th, 2014
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.32 KB | None | 0 0
  1. name = ...
  2. if not(name) then
  3.     term.setTextColor(colors.yellow)
  4.     print("Usage: locate <filename>")
  5.     return
  6. end
  7.  
  8. local function search(dir)
  9.     for k, v in pairs(fs.list(dir)) do
  10.         if (dir..v):find(name) then
  11.             print(dir..v)
  12.         end
  13.        
  14.         if fs.isDir(dir..v) then
  15.             search(dir..v.."/")
  16.         end
  17.     end
  18. end
  19.  
  20. search("/")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement