can't delete file/folder

  • Thread starter Thread starter Buffy
  • Start date Start date
B

Buffy

Hi, I am working on app running on Xp embedded.
My program doesn't seem to delete files or folders sometimes.
It happens occasionally.
Files are TXT, PDF, zip, and some binary files.
The program checks if the file/folder is "read-only" and change it to
writeable.

Is this related to "file indexing service"? How can I change this if I
don't have window's explorer?

Thanks.

-B
 
Buffy,

What APIs do you use to delete the files? Any error code returned? Check GetLastError.

Also, check if you have EWF running and enabled on the device.
 
Buffy,

Why do you need to know if file is read only? Also folders can't be read only is the first place they use only permissions given to
specific users or nothing at all.
You need minimum of "Delete Subfolders and files" privileges for certain user to be able to delete files and folders on NTFS.

Regards,
Slobodan
 
Konstantin,
On NTFS you can have FILE_ATTRIBUTE_READONLY attribute specified for a folder.
Also, the documentation does not say it is not suported for directories:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/getfileattributes.asp

Interesting apparently you are right. Using the attrib +R command from command line it is possible to set read-only flag to folder.
Reading state of this flag from GUI or changing it is not possible. So figure this out.

Regards,
Slobodan
 
Slobodan,
Interesting apparently you are right. Using the attrib +R command from command line it is possible to set read-only flag to folder.
Reading state of this flag from GUI or changing it is not possible. So figure this out.

You can read/change that attribute from GUI too. But only on NTFS (that is why I mentioned it). On FAT the attribute, while it is
still there and "readable", does not seem to be supported - it is always grayed out (but not disabled).

I knew that on the NTFS version that came up with XP (see Google for "kernel changes on XP") that introduced new read-only attrubute
for Volumes. Although this seems to be unrelated :-)

Regards,
Konstantin
 
Konstantin,
You can read/change that attribute from GUI too. But only on NTFS (that is why I mentioned it). On FAT the attribute, while it is
still there and "readable", does not seem to be supported - it is always grayed out (but not disabled).

On NTFS with XPP SP1 it is always a square. Neither checked nor unchecked.

Regards,
Slobodan
 
Slobodan,
On NTFS with XPP SP1 it is always a square. Neither checked nor unchecked.

Well.. You see the square there because you have XP-like UI. I have applied 2K style on my XP Pro PC and that is why I see old
"grayed out" check-boxes instead of squares :-)
Basically the grayed out state (or the square) in this case means that a change in check-box state may be applied to all the files
within the directory selected.

I am not sure what exactly I did but I was able to set/usnet the flag for a directory on NTFS volume on XP Pro SP2 using GUI (I mean
I re-open the directory properties and the checkbox was cleared). Although I am not able to repro this once again (the flag is
grayed out for other directories and I can't find that folder I had played with :-) ) so I am not sure I was right when I said it
worked from GUI too.

Anyway, the attribute is there from API point of view (I also can change it with attrib or other command line tools that basically
call to the API).

Regards,
Konstantin
 
Back
Top