Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: unlink fails to delete files with perculiar names

by Eliya (Vicar)
on Nov 22, 2011 at 10:45 UTC ( #939421=note: print w/replies, xml ) Need Help??


in reply to Re: unlink fails to delete files with perculiar names
in thread unlink fails to delete files with perculiar names

The OP doesn't say how $targ was set.  It's merely speculation that he assigned it using a double-quoted literal. It might just as well have come from a readdir or whatever.

Also, why would unlink have returned 1, as the OP states? That should only have happened in the (unlikely) case there also was a file 'D:/Users/Dave/Documents/Personal/CV/~ Vitae - 09 June 2007.doc' around at the time of the unlink call.

Replies are listed 'Best First'.
Re^3: unlink fails to delete files with perculiar names
by BrowserUk (Pope) on Nov 22, 2011 at 11:02 UTC
    It's merely speculation that he assigned it using a double-quoted literal

    Agreed. That's why likely work.

    It might just as well have come from a readdir

    But don't you have to combine the values from readdir with the path in order to get a fully qualified path?

    Could he be doing something like  $targ = "$path/$fname";?

    why would unlink have returned 1, as the OP states?

    Not sure, but that construct looks suspect to me: my($no) = unlink $targ || carp "Unable to delete file $targ\n";.

    What ends up in $no if unlink returns 0; the return value from carp()?


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Yup
      $ perl -MCarp -e " my $f = unlink (666) || carp 1; die $f " 1 at -e line 1 1 at -e line 1.
Re^3: unlink fails to delete files with perculiar names
by DaveARoberts (Acolyte) on Nov 22, 2011 at 16:38 UTC

    in my full code I get the file name using File::Find. From a windows directory listing from the command line the file is invisible, also from an explorer window...and from the application (MS word in this case) that presumeably created this as a temporary file it is also invisible.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://939421]
help
Chatterbox?
[Mr. Muskrat]: (considered) Re^3: Please help with Regexp::Common needs to be reparented to Re^2: Please help with Regexp::Common
[Mr. Muskrat]: Is it just me or does that timeout issue seems to be happening more often lately?
[Corion]: Mr. Muskrat: I'm not sure if it really happens more often, but I don't exactly know either
[LanX]: yep
[LanX]: more often for some weeks now
[Corion]: I think I'll have to manually (as god) intervene with that node, as the simple reparenting didn't seem to fix the parent/child relationship of the nodes

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2017-01-19 16:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (170 votes). Check out past polls.