Rev 41 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 41 | Rev 42 | ||
---|---|---|---|
Line 27... | Line 27... | ||
27 | IO.puts "Usage: " <> progname <> " filefind" |
27 | IO.puts "Usage: " <> progname <> " filefind" |
28 | IO.puts mesg |
28 | IO.puts mesg |
29 | end |
29 | end |
30 | 30 | ||
31 | def traverse(directory) do |
31 | def traverse(directory) do |
- | 32 | curdir = System.cwd() |
|
32 | File.cd!(directory) |
33 | File.cd!(directory) |
33 | curdir2 = System.cwd() |
34 | curdir2 = System.cwd() |
34 | files = File.ls!(directory) |
35 | files = File.ls!(directory) |
35 | for file <- files do |
36 | for file <- files do |
36 | pfile = curdir2 <> "/" <> file |
37 | pfile = curdir2 <> "/" <> file |
37 | IO.puts pfile |
38 | IO.puts pfile |
38 | if File.dir?(pfile) do |
39 | if File.dir?(pfile) do |
39 | traverse(pfile) |
40 | traverse(pfile) |
40 | end |
41 | end |
41 | end |
42 | end |
- | 43 | File.cd!(curdir) |
|
42 | end |
44 | end |
43 | 45 | ||
44 | def start_traverse(directory) do |
46 | def start_traverse(directory) do |
45 | IO.puts directory |
47 | IO.puts directory |
46 | traverse(directory) |
48 | traverse(directory) |
Line 48... | Line 50... | ||
48 | end |
50 | end |
49 | 51 | ||
50 | # ============================================================================= |
52 | # ============================================================================= |
51 | # Main |
53 | # Main |
52 | # ============================================================================= |
54 | # ============================================================================= |
53 | # |
- | |
54 | progname = System.cwd() |
- | |
55 | 55 | ||
- | 56 | progname = System.cwd() |
|
56 | if length(System.argv) == 1 do |
57 | if length(System.argv) == 1 do |
57 | directory = Enum.at(System.argv(), 0) |
58 | directory = Enum.at(System.argv(), 0) |
58 | if File.dir?(directory) |
59 | if File.dir?(directory) |
59 | do |
60 | do |
60 | DezeModule.start_traverse(directory) |
61 | DezeModule.start_traverse(directory) |