PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > alt.php > Removing multiple directories
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Removing multiple directories

Réponse
 
LinkBack Outils de la discussion
Vieux 22/11/2007, 20h44   #1
sam ruos
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Removing multiple directories

I have an issue here guys...

I can't seem to be able to mrdir on multiple entries at a time. Any
would be much appreciated...

From a display list, I have a checkbox next to each entry for deleting the
entries, eg. I want to delete five of those.

After confirming?submitting the deletion form, I collect the checked values
and store them in an array along with their ID ofcourse, then using the for
loop calling a function that would:

1. Get the name of the directory that was stored in DB (using unique ID).
The folder or directory was created during upload of files.
2. Call for another function DELETE_ALL_FILES($id[$i], $DB_name,
$DefaultDir) to delete any files in this folder
3. And then within this function I call for another function
REMOVE_DIR($foldername, $DefaultDir) and then after removing the affected
directory, then lastly to delete the record from the DB.

It works! But only on an entry at a time!

Any better solution to go around this? Is there anything to do with
opendir() and chdir() and closedir()?
I'm stuck now... and frustrated.

Thankx beforehand
-sammy



  Réponse avec citation
Vieux 23/11/2007, 18h28   #2
Tom
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Removing multiple directories

On Thu, 22 Nov 2007 20:44:11 GMT, sam ruos wrote...
>
>I have an issue here guys...
>
>I can't seem to be able to mrdir on multiple entries at a time. Any
>would be much appreciated...
>
>From a display list, I have a checkbox next to each entry for deleting the
>entries, eg. I want to delete five of those.
>
>After confirming?submitting the deletion form, I collect the checked values
>and store them in an array along with their ID ofcourse, then using the for
>loop calling a function that would:
>
>1. Get the name of the directory that was stored in DB (using unique ID).
>The folder or directory was created during upload of files.
>2. Call for another function DELETE_ALL_FILES($id[$i], $DB_name,
>$DefaultDir) to delete any files in this folder
>3. And then within this function I call for another function
>REMOVE_DIR($foldername, $DefaultDir) and then after removing the affected
>directory, then lastly to delete the record from the DB.
>
>It works! But only on an entry at a time!
>
>Any better solution to go around this? Is there anything to do with
>opendir() and chdir() and closedir()?
>I'm stuck now... and frustrated.
>
>Thankx beforehand
>-sammy
>
>
>


On the PHP site their site docs had some information for unlink() that might be
ful.

http://www.php.net/manual/en/function.unlink.php

This was the last user comment and may be in line with what you're looking for.

<?
function delfile($str)
{
foreach(glob($str) as $fn) {
unlink($fn);
}
}
?>

Tom
--
NewsGuy Accounts Go Jumbo!
Extra NewsGuy increased from 30 to 50 GB of download capacity
http://newsguy.com/overview.htm

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 22h36.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09730 seconds with 10 queries