473,406 Members | 2,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

delete folder

anfetienne
424 256MB
hi ive got a folder on my server which is created by apache and the only way to delete it is with server coding.

can someone tell me a way to delete that folder including all files and folders within it?
May 8 '09 #1
4 2002
Ciary
247 Expert 100+
Expand|Select|Wrap|Line Numbers
  1. foreach(glob($mydir."/*") as $val){
  2.    if(is_dir($val)){
  3.       foreach(glob($val."/*") as $v){
  4.          if(is_dir($v)){
  5.             ...       //you'll need to do this a few times to be sure all subfolders will be deleted
  6.          }else{
  7.             unlink($v);
  8.          }
  9.       }
  10.       rmdir($mydir);
  11.    }else{
  12.       unlink($val);
  13.    }
  14. }
  15. rmdir($mydir);
May 8 '09 #2
Dormilich
8,658 Expert Mod 8TB
@anfetienne
out of interest, what causes that? and deleting via FTP didn't work (permissions?)

@anfetienne
if you have a shell prompt for your server and sufficient permissions, you may execute the appropriate commands there (e.g. rmdir -r (*nix))
May 8 '09 #3
anfetienne
424 256MB
basically if you create folders with php code & apache you cant delete via ftp.....because the permissions set are through and for apache.....even if its 0777 you cant delete it

i had to consult my hosting company and this is what they told me
May 8 '09 #4
Dormilich
8,658 Expert Mod 8TB
ah, ok, good to know. maybe shell_exec() can help too.
May 8 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Alf Laue | last post by:
Hi, how do I delete a folder at my ftp-server, that was automatically created through a installation script? I dont have the permission to delete that folder :-( Thx for your help Alf
2
by: Keith Smith | last post by:
I have noticed that when I uninstall my app it doesn't delete the Program Files / MyApp folder if there are "new" files in it that weren't there before. It deletes all files except the "new" ones....
3
by: News | last post by:
Is it possible to delete a file by copying it to the "bit bucket" or "null device"? Back in my youth when I live in VMS-land you could delete a file by copying it to NL: ========== I have...
7
by: Charts | last post by:
I login as administrator of the machine. However running the following code get access denied exception for file inside the directory. The source code: DirectoryInfo target = new...
9
by: Paul | last post by:
I'm trying to make get my app to delete all the files in a specified folder and all the files within the folders of the specified folder. e.g. Folder 1 contains three files (File1, File2, File3)...
3
by: ad | last post by:
Hi, How can I delete all files in a folder by C# for example, I want to delete all files under c:\Test
4
by: Zeb | last post by:
Hi I'm using DirectoryInfo.Delete so that when a product is removed, all it's associated images (including the folder they sit in) are deleted. This actually seems to work fine. However, the...
24
by: biganthony via AccessMonster.com | last post by:
Hi, I have the following code to select a folder and then delete it. I keep getting a Path/File error on the line that deletes the actual folder. The line before that line deletes the files in...
4
by: - HAL9000 | last post by:
When un-installing an application... Is it normal practice to write a special program that erases all the files and folders for all the users of an application that reads and writes to...
0
by: wolfsbane | last post by:
Alright, here it is I am trying to write a win32 app in VB 2005 to clean up user's profiles. everything works correctly except for the Delete("directory", True) statement. I get a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.