How to delete rogue nul files

Eric Hanchrow offby1@blarg.net
Wed Jul 21 17:33:00 GMT 2004


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/



More information about the Cygwin mailing list