how do i i figured out how to make one now i need to know how to delete the directory(and everythin thats inside it) WITH PHP
SKANK!!!!!
5
Posting Pro in Training
Recommended Answers
Jump to PostThis should work, but I have not tested it, just call deleteDir with the directory you want to remove.
<? function deleteDir($dir) { if(is_dir($dir)) { $dir_handle = opendir($dir); while($entry = readdir($dir)) { if ($entry!= "." && $entry!= "..") { unlink($entry); } } } closedir($dir); rmdir($dir); } ?>
Jump to Postthe function he gave you will cos of the unlink() this will delete the files in the folder before deleting the folder. the rmdir() only works on an empty folder and also try to get a php manual that will help you with php functions. shalom shalom
Jump to PostIf it doesn't it's simple to delete the contents of a folder:
<?php $folder = "/FOLDER_NAME/"; while( $file = scandir( $folder ) ) { rename( $file , false ); } ?>
Jump to Postcheck the directory you pass to it, cos it will only delete the directory passed to it so error might be in your path
All 13 Replies
Will Gresham
81
Master Poster
SKANK!!!!!
5
Posting Pro in Training
omoabobade
0
Light Poster
Froger93
1
Junior Poster in Training
SKANK!!!!!
5
Posting Pro in Training
omoabobade
0
Light Poster
Will Gresham
81
Master Poster
SKANK!!!!!
5
Posting Pro in Training
SKANK!!!!!
5
Posting Pro in Training
Froger93
1
Junior Poster in Training
SKANK!!!!!
5
Posting Pro in Training
Froger93
1
Junior Poster in Training
SKANK!!!!!
5
Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.