begin process at 2012 02 09 02:56:16
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Fichier / Disque

 > CREATION DE L'ARBORESCENCE D'UN NOUVEAU RÉPERTOIRE

CREATION DE L'ARBORESCENCE D'UN NOUVEAU RÉPERTOIRE


 Information sur la source

Note :
Aucune note
Catégorie :Fichier / Disque Niveau :Débutant Date de création :19/04/2002 Date de mise à jour :19/04/2002 17:58:54 Vu :1 941

Auteur : clintz

Ecrire un message privé
Commentaire sur cette source (2)
Ajouter un commentaire et/ou une note

 Description

voir le titre

Source

  • Public Function RepertoireCreation(ByVal RptChm As String) As Boolean
  • '
  • Dim RptTbl() As String
  • Dim Niveau As Integer
  • Dim Trouve As Boolean
  • Dim TmpTbl() As String
  • Dim TmpAtr As Integer
  • '
  • On Error Resume Next
  • RptTbl = Split(RptChm, "\")
  • Trouve = False
  • Niveau = UBound(RptTbl)
  • While ((Niveau >= 0) And (Not Trouve))
  • TmpTbl = RptTbl
  • ReDim Preserve TmpTbl(0 To Niveau)
  • RptChm = Join(TmpTbl, "\")
  • Err.Clear
  • TmpAtr = GetAttr(RptChm)
  • If (Err.Number = 0) Then
  • If ((TmpAtr And vbDirectory) = vbDirectory) Then
  • Trouve = True
  • Else
  • Niveau = 0
  • End If
  • End If
  • If (Not Trouve) Then
  • Niveau = Niveau - 1
  • End If
  • Wend
  • If ((Trouve) And (Niveau < UBound(RptTbl))) Then
  • While ((Niveau < UBound(RptTbl)) And (Trouve))
  • Niveau = Niveau + 1
  • TmpTbl = RptTbl
  • ReDim Preserve TmpTbl(0 To Niveau)
  • RptChm = Join(TmpTbl, "\")
  • MkDir RptChm
  • Trouve = (Err.Number = 0)
  • Wend
  • End If
  • RepertoireCreation = Trouve
  • End Function
Public Function RepertoireCreation(ByVal RptChm As String) As Boolean
'
Dim RptTbl() As String
Dim Niveau   As Integer
Dim Trouve   As Boolean
Dim TmpTbl() As String
Dim TmpAtr   As Integer
'
  On Error Resume Next
  RptTbl = Split(RptChm, "\")
  
  Trouve = False
  Niveau = UBound(RptTbl)
  While ((Niveau >= 0) And (Not Trouve))
    
    TmpTbl = RptTbl
    ReDim Preserve TmpTbl(0 To Niveau)
    RptChm = Join(TmpTbl, "\")
    
    Err.Clear
    TmpAtr = GetAttr(RptChm)
    If (Err.Number = 0) Then
      If ((TmpAtr And vbDirectory) = vbDirectory) Then
        Trouve = True
      Else
        Niveau = 0
      End If
    End If
    
    If (Not Trouve) Then
      Niveau = Niveau - 1
    End If
    
  Wend
  
  If ((Trouve) And (Niveau < UBound(RptTbl))) Then
  
    While ((Niveau < UBound(RptTbl)) And (Trouve))
      
      Niveau = Niveau + 1
      TmpTbl = RptTbl
      ReDim Preserve TmpTbl(0 To Niveau)
      RptChm = Join(TmpTbl, "\")
      
      MkDir RptChm
      
      Trouve = (Err.Number = 0)
      
    Wend
  
  End If

  RepertoireCreation = Trouve

End Function

 

 Conclusion

Pas de commentaire, désolé !


 Sources de la même categorie

Source avec Zip Source .NET (Dotnet) MODIFIER LES EXTENSION DES FICHIERS par okosa
ROUTINE DIR RÉCURSIVE POUR OBTENIR LA LISTE DE TOUS LES FICH... par kerisolde
Source avec Zip Source avec une capture FILE,SECURITY,FICHIER par okosa
Source avec Zip Source avec une capture Source .NET (Dotnet) PATCHEUR DE FICHIER par tototh
Source avec Zip Source avec une capture LECTURE DES INFORMATIONS DES DISQUES COMPOSANT UN ENSEMBLE R... par jack

Commentaires et avis

Commentaire de logisim le 21/04/2002 11:06:15

Il y a plus simple ! C'est d'utiliser l'API :

Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal lpPath As String) As Long

Exemple :

MakeSureDirectoryPathExists "C:DossierSousdossier"

(ne pas oublier le backslash à la fin)

Commentaire de jmc70 le 13/03/2004 18:37:40

Merci à Logisim pour cette API qui fonctionne même pour un chemin réseau du type \\poste 4\truc\machin\ (ce ce je cherchais)

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

Consulter la suite du CalendriCode

Photothèque

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 3,557 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales