SitePoint Sponsor |
|
User Tag List
Results 1 to 9 of 9
Thread: Warning when using Unlink!
-
Jun 23, 2007, 04:41 #1
- Join Date
- Dec 2004
- Location
- At My Desk!!
- Posts
- 1,642
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Warning when using Unlink!
I am trying to delete a file and am getting this error message
Warning: unlink(Includes/Modules/News_Manager) [function.unlink]: Is a directory in /home/hvknuamn/public_html/mainbuild/Includes/Modules/Module_Manager/Module_Functions.php on line 35
This directory is the place I am calling the unlink function from, I dont understand why im getting this. Any ideas?
Thanks in advance
p.s the file has correct permissions to delete and im not getting file not found, so it cant be that"Am I the only one doing ASP.NET in Delphi(Pascal)?"
-
Jun 23, 2007, 05:09 #2
- Join Date
- Aug 2004
- Location
- Manchester UK
- Posts
- 13,807
- Mentioned
- 158 Post(s)
- Tagged
- 3 Thread(s)
afternoon
The script thinks you are trying to delete an entire directory, post your script...Mike Swiffin - Community Team Advisor
Only a woman can read between the lines of a one word answer.....
-
Jun 23, 2007, 05:15 #3
- Join Date
- Dec 2004
- Location
- At My Desk!!
- Posts
- 1,642
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hiya Mate,
I am
PHP Code:$filetodelete = "Includes/Modules/" . $deleteid . "_Manager";
unlink($filetodelete);
"Am I the only one doing ASP.NET in Delphi(Pascal)?"
-
Jun 23, 2007, 05:17 #4
- Join Date
- Aug 2004
- Location
- Manchester UK
- Posts
- 13,807
- Mentioned
- 158 Post(s)
- Tagged
- 3 Thread(s)
Is the News_Manager an actual file?
As it is the script is still assuming it's a directory called News_Manager.
You might be able to put a condition in using is_file() to check the file first.Mike Swiffin - Community Team Advisor
Only a woman can read between the lines of a one word answer.....
-
Jun 23, 2007, 05:18 #5
- Join Date
- Dec 2004
- Location
- At My Desk!!
- Posts
- 1,642
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
No its a directory. I want to just delete that folder and its contents
"Am I the only one doing ASP.NET in Delphi(Pascal)?"
-
Jun 23, 2007, 05:19 #6
Or if you are actually trying to delete the directory, use rmdir. Just make sure it is empty before you do.
Saul
-
Jun 23, 2007, 05:24 #7
- Join Date
- Aug 2004
- Location
- Manchester UK
- Posts
- 13,807
- Mentioned
- 158 Post(s)
- Tagged
- 3 Thread(s)
then do what php_daemon said
Youwill probably need to iterate through the dir first and delete the files and then delete the folderMike Swiffin - Community Team Advisor
Only a woman can read between the lines of a one word answer.....
-
Jun 23, 2007, 06:03 #8
- Join Date
- Dec 2004
- Location
- At My Desk!!
- Posts
- 1,642
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yeh, thanks guys, I used this in the end:
PHP Code:foreach (glob("Includes/Modules/" . $deleteid . "_Manager/*.*") as $filetodelete) {
unlink($filetodelete);
}
$dirtodelete = "Includes/Modules/" . $deleteid . "_Manager";
rmdir($dirtodelete);
"Am I the only one doing ASP.NET in Delphi(Pascal)?"
-
Jun 23, 2007, 06:08 #9
- Join Date
- Aug 2004
- Location
- Manchester UK
- Posts
- 13,807
- Mentioned
- 158 Post(s)
- Tagged
- 3 Thread(s)
looks good to me! glad you got it sorted
Mike Swiffin - Community Team Advisor
Only a woman can read between the lines of a one word answer.....
Bookmarks