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 106... | Line 107... | ||
106 | } |
107 | } |
107 | 108 | ||
108 | # --- |
109 | # --- |
109 | 110 | ||
110 | $show_verbose = false; |
111 | $show_verbose = false; |
- | 112 | $do_recursive = false; |
|
111 | $dir = ''; |
113 | $dir = ''; |
112 | 114 | ||
113 | for ($i=1; $i<$argc; $i++) { |
115 | for ($i=1; $i<$argc; $i++) { |
114 | if ($argv[$i] == '-v') { |
116 | if ($argv[$i] == '-v') { |
115 | $show_verbose = true; |
117 | $show_verbose = true; |
- | 118 | } else if ($argv[$i] == '-r') { |
|
- | 119 | $do_recursive = true; |
|
116 | } else { |
120 | } else { |
117 | $dir = $argv[$i]; |
121 | $dir = $argv[$i]; |
118 | } |
122 | } |
119 | } |
123 | } |
120 | 124 | ||
121 | if (empty($dir)) { |
125 | if (empty($dir)) { |
122 | echo "Syntax: $argv[0] [-v] <directory>\n"; |
126 | echo "Syntax: $argv[0] [-v] [-r] <directory>\n"; |
123 | exit(2); |
127 | exit(2); |
124 | } |
128 | } |
125 | 129 | ||
126 | if (!is_dir($dir)) { |
130 | if (!is_dir($dir)) { |
127 | echo "Directory not found\n"; |
131 | echo "Directory not found\n"; |