AntiGuide: WinCopyFilesDIY



PagePrincipale :: DerniersChangements :: ParametresUtilisateur :: Vous êtes 216.73.217.5 :: Signaler un abus :: le: 20250729 05:29:23
2do:

20140427

essai sur acem1641
termine: folders:92307 files: 830817 octets: 178987455832
propriétés: 830554 fichiers, 91377 dossiers, 179 797 702 375
donc il en manque
modifié avec compte des fixh
ier pas accessible (pas de dossiers) 11:00 5 Go de copiés 4 200 000 000 octets lus et ecrits
les inaccesibles
13:48: plus de 23 go, donc plus det 10 Go /heure
17:12: 60 Go
00:41: termine: folders:57258 files: 482981 octets: 125072549113
donc environ 10 Go / heure (à compare aux 20 Go de ntbackup sur le Vostro1710?

20140428
compression de dna3 par windows (10 Go, 100000 fichiers), estimé une heure puis 4!
vidé corbeille, 2600 éléments 1.93 Go
passé en attr4.txt
lancé sans copie un peu avant 09:00
lecture de 33 go!
start:28/04/2014 08:32:48
now :28/04/2014 11:14:57
termine: folders:91707 files: 702468 octets: 168162806042

gaffe: l'effacement des 120 Go d'hier a duré plus de 4 heures, et 20 fichiers au noms "trop longs" pou la cible (il n'était pourtant pas question de poubelle)

' pof - 20140428 -  106:00
' GAFFE: totfo pas bon!
' gaffe totaux remontés quand exit function !
start=now
g=chr(34) ' guillemet sans perturber antiguide
source="c:\"
cible="y:\"
outf="attr5.txt"
periode=1000
copy=false ' true
keepattr=true
keepfolderdate=true
printok=false ' true ' true pour lister tous les noms de fichiers lisibles!
box=false ' true pour arrêter sur erreur par msgbox
tot=0
bytedufo=0 ' pour totl emboites
totrefus=0
nbfiles=0
nbfolders=0
Set fs = CreateObject("Scripting.FileSystemObject")
if fs.fileexists(outf) then 
   msgbox "ooops: fichier log existe déjà: " & outf
   wscript.quit
end if
set fi=fs.createtextfile(outf)
fi.writeline "explore de " & source
fi.writeline "start:" & start
set racine=fs.getfolder(source)
dofolder racine,source
fi.writeline "start:" & start
fi.writeline "now  :" & now

fi.writeline "termine: folders:" &  nbfolders & " files: " & nbfiles & " octets: " & tot 
msgbox "termine folders:" &  nbfolders & " files: " & nbfiles & " octets: " & tot  & " refus=" & totrefus & " gt=" & tot+totrefus


function dofiles(fc,full)
totfiles=0
t=0
nb=0 ' compter les gfichier traités de ce doissier
on error resume next
for Each f1 in fc 
     ok="error"
     if err.number<> 0 then 
            xx=err.number
            dd=err.description 
            err.clear
            on error goto 0
            if box then msgbox "erreur foreach " & xx & " " & full   
            fi.writeline "error: foreach files " & xx & " " & dd & " :  nb:" & nb & " "  & g & full  & g
            exit function
    end if
    nb=nb+1

    on error resume next
    t=f1.size
    if err.number<> 0 then 
            xx=err.number
            dd=err.description 
            err.clear
            on error goto 0
            if box then msgbox "erreur f1.size" & xx & " " & full   
            fi.writeline "error f1.size: " & xx & " " & dd &  " " & g  & full & g
    else 
        on error goto 0
        totrefus=totrefus+t ' on deduira si copie!
        ff= full 
        if mid(ff,len(ff))<>"\" then ff=ff & "\" 
        ff = ff & f1.name
        attrfi=f1.attributes
        '     msgbox f1.name & " " & attrfi & decodeattr(attrfi)
        on error resume next
        set lire=fs.opentextfile(ff)
        totrefus=totrefus+t
        if err.number<> 0 then 
            xx=err.number
            dd=err.description 
            err.clear
            on error goto 0
            if box then msgbox "erreur open file " & xx & " " & dd & "  " & decodeattr(attrfi) & " " & ff   
            fi.writeline "error open file: " & xx & " " & dd &  " " & decodeattr(attrfi) & " : taille: " & t & "  " & g & ff  & g
        else
           on error goto 0
           lire.close
           bytesdufo=bytedufo+t  ' somme des tailles de fichiers dans le subfolder
           totfiles=totfiles+t
           tot=tot +t
           totfo=totfo+t
           totrefus=totrefus-t
           outfile=cible & mid(full,4) & "\" & f1.name
           if copy then 
               fs.copyfile f1, outfile
               ok= "copied" 
           else 
             ok="read"
           end if
           if copy and keepattr then 
               set sa=fs.getfile(outfile)
               sa.attributes=attrfi
           end if 
           if printok then fi.writeline ok & ": " & decodeattr(attrfi) & " " & f1.size & " " & g & f1.name & g & " " & g & full &  g 
           nbfiles=nbfiles+1
    if (nbfiles mod periode)=1 then fi.writeline "now: " & now & " folders:" &  nbfolders & " files: " & nbfiles & " octets: " & tot 
        end if ' otrefus
     end if ' file error
Next ' for each
 
dofiles=totfiles
end function

function dosubfolders (fc,full)
   totfo=0 ' local
   For Each f1 in fc 
      ff=full
      if mid(ff,len(ff))<>"\" then ff=ff & "\"
      totfo=totfo+dofolder (f1,ff & f1.name)
    Next
   if printok then fi.writeline "folder_tot: " & totfo & " " & g & ici & g 
dosubfolders=totfo
end function

function dofolder (ici,full)
totby=0 'locale
bytedufo=0 ' comptera les octets copiés
' msgbox "creeate " & cible & mid(full,4)
attrfo=ici.attributes
' msgbox full & " " & attrfo & decodeattr(attrfo)
if copy and len(full)>3 then 
    outfolder=cible & mid(full,4)
    fs.createfolder outfolder
          if keepfolderdate then 
               set sa=fs.getfolder(outfolder)
               sa.datecreated=ici.datecreated
               sa.datelastaccessed=ici.datelastaccessed
               sa.datelastmodified=ici.datelastmodified
          end if 
 
    end if
totfo=0
if printok then  fi.writeline "folderfull: " & decodeattr(attrfo) & " " & g & full & "\" & g 
nbfolders=nbfolders+1
' files
on error resume next
Set icifiles = ici.Files
if err.number>0 then 
    xx=err.number
    d=err.description
    on error goto 0
    fi.writeline "error_ici.files " & xx & " " & dd & " " & decodeattr(attrfo) & " " & g & full & "\" & g 
    exit function
end if
on error goto 0

on error resume next
fcc=icifiles.count
   if err.number> 0 then 
             xx=err.number
            dd=err.description 
            err.clear
            on error goto 0
            fi.writeline "error getting file count: " & xx & " " & dd & " : " & decodeattr(attrfo) & " " & g & full & "\" & g
            exit function
   end if  
  on error goto 0
if printok then  fi.writeline "files_count: " & fcc 
   totby=totby+dofiles (icifiles,full)
   on error resume next 
   Set icifolders = ici.subFolders
   if err.number<> 0 then 
             xx=err.number
            dd=err.description 
            err.clear
            on error goto 0
            fi.writeline "error getting subfolders: " & xx & " " & dd & " : " & g & full & "\" & g
            exit function
   end if  
on error goto 0
 if printok then fi.writeline "subfolders_count: " & icifolders.count 
 
   totby=totby+dosubfolders (icifolders,full)

if copy and (keepattr or keepfolderdate) and (len(full)>3) then 
               set sa=fs.getfolder(outfolder)
          if keepfolderdate then 
               sa.datecreated=ici.datecreated
               sa.datelastaccessed=ici.datelastaccessed
               sa.datelastmodified=ici.datelastmodified
          end if 
          if keepattr then 
               sa.attributes=attrfo
           end if 
 
    end if
dofolder=totby
end function

function decodeattr(num)
       attr="-"
        if (num and 1) <>0 then attr=attr & "R"
        if (num and 2) <>0 then attr=attr & "H"
         if (num and 4) <>0 then attr=attr & "S"
        if (num and 8) <>0 then attr=attr & "V"
        if (num and 16) <>0 then attr=attr & "D"
        if (num and 32) <>0 then attr=attr & "A"
        if (num and 64) <>0 then attr=attr & "L"
        if (num and 128) <>0 then attr=attr & "C"
decodeattr= attr
end function