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