is_deletable function? Check if a file can be deleted

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

is_deletable function? Check if a file can be deleted

Post by Sindarin »

I use the is_writable to determine if a file can be written, but how can I tell if a file can be deleted under a Windows environment? Even if the file has write permissions, it can't be deleted.
nyoka
Forum Commoner
Posts: 45
Joined: Thu Apr 09, 2009 12:53 pm

Re: is_deletable function? Check if a file can be deleted

Post by nyoka »

You could you the php functions stat or fstat, the element that you want to look at is '2' or 'mode' from the returned associative array.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: is_deletable function? Check if a file can be deleted

Post by requinix »

Try is_writable on the parent directory.
Post Reply