Lecture fichiers

alahyaneali Messages postés 25 Date d'inscription vendredi 19 novembre 2004 Statut Membre Dernière intervention 12 octobre 2007 - 24 déc. 2004 à 11:18
cs_Anthomicro Messages postés 9433 Date d'inscription mardi 9 octobre 2001 Statut Membre Dernière intervention 13 avril 2007 - 26 déc. 2004 à 13:15
Bonjour
je voudrais faire afficher les fichiers d'un repertoire triés
dont le nom est supérieur à im_2432345.jpg et inférieur à im_2432445.jpg
en utilisant la boucle suivante
$repertoire="/repV";
if(!($dp=opendir($repertoire))) 
  {
       die("Impossible d'ouvrir $repertoire.");
  }
  
  while ($fichier = readdir($dp))
  {
   if($fichier != '.' && $fichier != '..')
   {
        echo "$repertoire/$fichier";
   }
  }

2 réponses

malalam Messages postés 10839 Date d'inscription lundi 24 février 2003 Statut Membre Dernière intervention 2 mars 2010 25
24 déc. 2004 à 14:47
Salut,

chais pas, tu peux placer tes $file dans un tableau, puis trier le tableau, et enfin n'afficher que le resultat du tri compris entre tes 2 valeurs.
0
cs_Anthomicro Messages postés 9433 Date d'inscription mardi 9 octobre 2001 Statut Membre Dernière intervention 13 avril 2007 8
26 déc. 2004 à 13:15
Salut ;-)

Essaies ça :

$repertoire='/repV';
if(!($dp=opendir($repertoire)))
{
die("Impossible d'ouvrir $repertoire.");
}

while ($fichier = readdir($dp))
{
if($fichier != '.' AND $fichier != '..' AND !is_dir($fichier))
{
$numero=intval(substr($fichier,3,strlen($fichier)-4));

if($numero>2432345 AND $numero<2432445)
{
echo $repertoire,'/',$fichier;
}
}
}

a +

Vulgarisation informatique : Entraide, dépannage et vulgarisation informatique

Forum informatique : Forum d'entraide informatique (14 catégories)
0
Rejoignez-nous