3 # Copyright (C) 1995, 1996, 1997, 2007, 2008, 2009 Free Software
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # This script is a very lame hack to remove local files, until the
21 # time when Wget proper will have this functionality.
22 # Use with utmost care!
24 # If the remote server supports BSD-style listings, set this to 0.
29 if (@ARGV && ($ARGV[0] eq '-v')) {
34 (@dirs = @ARGV) || push (@dirs,'.');
46 local(@lcfiles, @lcdirs, %files, @fl);
48 print STDERR "Processing directory '$dir':\n" if $verbose;
50 opendir(DH, $dir) || die("Cannot open $dir: $!\n");
53 # Read local files and directories.
54 foreach $_ (readdir(DH)) {
55 /^(\.listing|\.\.?)$/ && next;
66 if (open(FD, "<$dir/.listing")) {
69 # Weed out the line beginning with 'total'
71 # Weed out everything but plain files and symlinks.
74 $files{$fl[7 + $sysvlisting]} = 1;
77 foreach $_ (@lcfiles) {
84 print STDERR "Warning: $dir/.listing: $!\n";
86 foreach $_ (@lcdirs) {