| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 
 | #include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <string.h>
 
main()
{
   int i=0;
   char exe[]=".exe",avi[]=".avi",png[]=".png",bmp[]=".bmp",mp3[]=".mp3";
   char dll[]=".dll",wav[]=".wav",wma[]=".wma",jpg[]=".jpg",gif[]=".gif";
   char tif[]=".tif",asx[]=".asx";
 
   char *ext;
   char tt;
 
   struct dirent *lecture;
   DIR *rep;
   rep = opendir("E:\\");
   while ((lecture = readdir(rep)))
   {     
 
 
         ext=strrchr(lecture->d_name, '.');
         tt=*ext;
         if ((strcmp(tt,exe)==0)||(strcmp(tt,avi)==0)||(strcmp(tt,png)==0)||(strcmp(tt,bmp)==0)||(strcmp(tt,mp3)==0)||
(strcmp(tt,dll)==0)||(strcmp(tt,wav)==0)||(strcmp(tt,wma)==0)||(strcmp(tt,jpg)==0)||(strcmp(tt,gif)==0)||
(strcmp(tt,tif)==0)||(strcmp(tt,asx)==0))
            {     
                  remove(lecture->d_name);
                  i++;
            }
 
   }
   closedir(rep);
 
   printf("Il y a eu %d fichiers supprimer",i);
 
   system ("pause");
   return 0;
} | 
Partager