!636 !modernid main { static S programID; static S searchFor; psvm { if (args.length == 0) { print("I search for files under the current directory."); print("Syntax: " + programID + " filetosearch"); } searchFor = args[0]; scan("."); } static void scan(S file) { File f = new File(file); if (f.getName().equalsIgnoreCase(searchFor)) print("Found " + (f.isFile() ? "file" : "dir") + ": " + f.getPath()); if (f.isDirectory()) { File[] l = f.listFiles(); if (l != null) for (x : l) scan(x); } } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1000702 |
| Snippet name: | Find a file |
| Eternal ID of this version: | #1000702/1 |
| Text MD5: | 7e804e89a0c95c1ecffd98917235dd81 |
| Author: | stefan |
| Category: | |
| Type: | JavaX source code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-08-23 14:47:44 |
| Source code size: | 601 bytes / 27 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 949 / 929 |
| Referenced in: | #744 - Find a file #3000188 - Answer for stefanreich(>> t search) #3000382 - Answer for ferdie (>> t = 1, f = 0) |