Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

unlinking an index.dat file in windows

by Don Coyote (Hermit)
on Jul 01, 2010 at 18:43 UTC ( [id://847585]=perlquestion: print w/replies, xml ) Need Help??

Don Coyote has asked for the wisdom of the Perl Monks concerning the following question:

or I'm hungry and want to eat cookies!

In my windows pc. I have created a simple routine to go to a cookie dir, print out a list of files unlink them then print out contents again.

the index.dat file remains - I tried to open to write but will not allow, though i can open to read.
The ATTRIB is set to F (full control) so I don't understand why I cannot write or unlink the index.dat file?

for a bonus 10 points: also the -d flag doesn't spot the differnce between file and dir when i print the content list of the dir?

Replies are listed 'Best First'.
Re: unlinking an index.dat file in windows
by Anonymous Monk on Jul 01, 2010 at 19:09 UTC
    Because the file is already open by another program which has lock on it (explorer.exe/iexplore...)

      ok thanks, the ATTRIB has said that the file is not locked for writning though what would I need to do 'unlock' the file and write to it- because i can easily right click and delete but that is not the point

      I did search for a lot of hours to try and find answer to resolve this issue but there were no posts on any blogs/forums anywhere so I am dissapointed at being given neg rep - but it doesnt count if its from anonymous :}

        That "ATTRIB" thing you mention is probably the read-only flag. It's not a lock and you can overwrite a read-only file. In your case the file is opened by another program (lets say you opened a JPEG in Photoshop and can't delete the file from disk while it's opened in Photoshop) and the program itself locked the file not that attribute thing. You can't delete the file until the other program exits or closes the file. Use Process Explorer to see which program opened a handle to it (on Vista/7 you need to run as administrator). You can also get the process list with some Win32 modules I believe.
Re: unlinking an index.dat file in windows
by ww (Archbishop) on Jul 02, 2010 at 00:18 UTC
    What version of Windows?

    I ask because as of Vista (32bit) there is no attribute "F" nor is there any indication that attrib would need anything more than R/W to allow or forbid deletion unless it's a system file, as another reply suggests.

    As for your second post, anonymonks don't get to vote a node up or down... but this non-anonymonk downvoted it for the whine. As you'll also learn, a single up or down vote doesn't necessarily signify much more than that a post rubbed someone the wrong way, without regard to its actual merit.

      Don_Coyote - please read Voting/Experience System with special attention to a couple notions:
      1. The existance of a single - - or even a few downvotes of a node is likely NOT significant; consider a single downvote a random event sparked by excess relative velocity in a poly-saturated atmosphere. In other words, don't sweat the small stuff.
      2. The "Reputation" of a node reflect the judgement of those who have read it and bothered to vote on it, either because they consider it (well written|interesting|useful|insightful|other_desiderata) or because it (reflects lack of effort - including failure to search standard resources here, www-wide and on dead-trees|contains an ad hominem attack or a slur|complains about others' reactions to an earlier node by the same writer|includes other_utterances_contrary_to_the_local_mores)
      3. A node's reputation is NOT the same as XP, nor is it a final judgement on the merits of your continued use of space in which to stand or sit, O2, H2O and nutrition.

      Your latest post (the one where you got yourself signed in) comes close to downvote territory on several counts, but avoids one because of the funny observation about deleting your own cookies (except, of course, <Begin nitpick> the cookies set by PM are not yours, but the site's</nitpick>). But for the sake of your reputation and your customers' satisfaction, I do hope you'll postpone the urge to "wite (sic) websites with differing functionalities" until you lock onto a few more of the basics. (That last sentence, BTW, is entirely sincere and not intended as a "slur" but may be read as such... in which case, the saying "easy come; easy go" can and does apply to XP

      And further re your latest, DO NOT USE <PRE> TAGS HERE!. Another assignment, this one on another set of PM basics: read Writeup Formatting Tips , Markup in the Monastery and Perl Monks Approved HTML tags.

        Doh!

        no more 'pre'

        sz

        yeah I had to get the funny in else I don't think I would last much longer without really getting on everyone's nerves.

        thanks ww

      system is windows xp.32bit

      It would seem it is being use by another process which is why it is locked. However Im not sure if that is the case or if it is a system file exactly but index.dats are fairly common in dir's so most people will know what my knowledge is lacking from my query and be able to direct me to some relevant material. Which they have done. and thanks to them for that.

      If you are able to add further I welcome. I should say I prefer not to just download an app that does it for me. I've already got one of those - its called windows :P. re - right click and delete.

      i'm looking into process handling now. I think this would occur also on unix as it is universal. hopefully can install perl and apache on ubuntu 64 when i get that up and running - i'll need to know how to secure it first as I don't have a linux firewav

      re the whine - i'm still not getting this dwngrding business. I have purchased a web progamming book - it has a great starter for perl. Although you probably don't thinks because of my asking this question. It didn't mention some things, so I signed up and asked. I think that this is the point of seeking wisdom. If I already knew the answer i'd be bit daft wasting everyones time asking.

        comment above is me - Don Coyote - i hadn't unlocked the sign in process....

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://847585]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2024-04-23 08:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found