Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Syntactic Confectionery Delight
 
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.


Comment on Re^2: unlink fails to delete files with perculiar names
Select or Download Code
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 (Novice) 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?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2014-04-17 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (441 votes), past polls