This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to delete rogue nul files


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]