3 # Copyright (C) 1995, 1996, 1997 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 2 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, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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) {