Rev 12 | Rev 15 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 12 | Rev 13 | ||
---|---|---|---|
Line 55... | Line 55... | ||
55 | if (strtolower(substr($file, -4)) === '.md5') continue; |
55 | if (strtolower(substr($file, -4)) === '.md5') continue; |
56 | if (strtolower(substr($file, -4)) === '.sfv') continue; |
56 | if (strtolower(substr($file, -4)) === '.sfv') continue; |
57 | 57 | ||
58 | $fullpath = rtrim($directory,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$file; |
58 | $fullpath = rtrim($directory,DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$file; |
59 | if (is_dir($fullpath)) { |
59 | if (is_dir($fullpath)) { |
- | 60 | global $do_recursive; |
|
60 | _rec($fullpath); |
61 | if ($do_recursive) _rec($fullpath); |
61 | } else if (is_file($fullpath)) { |
62 | } else if (is_file($fullpath)) { |
62 | global $show_verbose; |
63 | global $show_verbose; |
63 | if ($show_verbose) echo "$fullpath\n"; |
64 | if ($show_verbose) echo "$fullpath\n"; |
64 | $dir = pathinfo($fullpath, PATHINFO_DIRNAME); |
65 | $dir = pathinfo($fullpath, PATHINFO_DIRNAME); |
65 | 66 | ||
Line 97... | Line 98... | ||
97 | } |
98 | } |
98 | 99 | ||
99 | # --- |
100 | # --- |
100 | 101 | ||
101 | $show_verbose = false; |
102 | $show_verbose = false; |
- | 103 | $do_recursive = false; |
|
102 | $dir = ''; |
104 | $dir = ''; |
103 | 105 | ||
104 | for ($i=1; $i<$argc; $i++) { |
106 | for ($i=1; $i<$argc; $i++) { |
105 | if ($argv[$i] == '-v') { |
107 | if ($argv[$i] == '-v') { |
106 | $show_verbose = true; |
108 | $show_verbose = true; |
- | 109 | } else if ($argv[$i] == '-r') { |
|
- | 110 | $do_recursive = true; |
|
107 | } else { |
111 | } else { |
108 | $dir = $argv[$i]; |
112 | $dir = $argv[$i]; |
109 | } |
113 | } |
110 | } |
114 | } |
111 | 115 | ||
112 | if (empty($dir)) { |
116 | if (empty($dir)) { |
113 | echo "Syntax: $argv[0] [-v] <directory>\n"; |
117 | echo "Syntax: $argv[0] [-v] [-r] <directory>\n"; |
114 | exit(2); |
118 | exit(2); |
115 | } |
119 | } |
116 | 120 | ||
117 | if (!is_dir($dir)) { |
121 | if (!is_dir($dir)) { |
118 | echo "Directory not found\n"; |
122 | echo "Directory not found\n"; |