This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: How to delete rogue nul files
- From: Eric Hanchrow <offby1 at blarg dot net>
- To: cygwin at cygwin dot com
- Date: Wed, 21 Jul 2004 10:26:41 -0700
- Subject: Re: How to delete rogue nul files
- References: <gd5tf09ne640a4hbd1gqracolb3u45jks7@4ax.com>
I've been using this:
#!/usr/bin/env perl
use warnings;
use strict;
use Data::Dumper;
die "This program is only useful on Cygwin.\n"
unless ($^O eq "cygwin");
my $filename = shift;
$filename =~ s(/nul$)()i;
$filename = qx(realpath $filename); chomp $filename;
$filename = qx(cygpath -w $filename); chomp $filename;
$filename = q(\\\\.\\) . $filename;
$filename .= "\\nul";
if (unlink $filename) {
print "Removed $filename.\n";
} else {
warn "Can't unlink $filename: $!";
}
--
A DRE voting system is one of the simplest computer
applications you could imagine. It just adds by one.
-- Brit Williams, emeritus professor of computer science
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/