4

From the command line when I use:

rm -fr /path/dir/{*,.??*}

I can delete all files in /path/dir including the hidden files, but when I try to make this from PHP with this code:

system('rm -fr /path/dir/{*,.??*}') nothing happens.

I can't find why this doesn't works

Adrian Cid Almaguer
  • 7,815
  • 13
  • 41
  • 63

2 Answers2

4

Finally with this:

system('rm -fr /path/dir && mkdir /path/dir);

I removed the directory with all his files and after I created the directory. And the work is done.

Adrian Cid Almaguer
  • 7,815
  • 13
  • 41
  • 63
0

If you don't want delete the directory itself, so you don't have to recreate it. This will delete all contents of directory including hidden files without warning msg.

rm -rf ..?* .[!.]* * 
Developer
  • 25,073
  • 20
  • 81
  • 128