1

Possible Duplicate:
how to delete a folder with contents using PHP

hi,

is it possible to delete all children within a parent directory and then delete the the parent directory in php?

Edited:

When i use scan dir why does the first 2 elements of the array show '.', '..'?:

> Array ( [0] => . [1] => .. [2] => evga-nvidia-graphics-card4d0fe6868d2f8.jpg [3] => image4d0eaafb920a0.png [4] => image4d0eab086a106.png ) 

many thanks

Community
  • 1
  • 1
Adamski
  • 5,769
  • 9
  • 32
  • 32

1 Answers1

1

The first elements in your array (. and ..) are references to the directory itself (.) and to its parent directory (..). Every non-root directory in your filesystem will have both of them. They are usually ignored by hand in this kind of scripts.

If you use a DirectoryIterator you can tell if the current element you're iterating over is either . or .. with the isDot() function.

ncuesta
  • 760
  • 4
  • 12