begin process at 2010 03 22 07:18:42
  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 682

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 avec une capture TRAITEMENT DES NOMS DE FICHIERS. par artgile
Source avec Zip Source .NET (Dotnet) GESTION DE PARC AUTOMOBILE AVEC SÉRIALISATION par guyr07
Source avec Zip Source avec une capture Source .NET (Dotnet) FICHIERS_CACHÉS_LECTURE_SEULE par Le Pivert
Source avec Zip Source avec une capture CHANGEUR D'ICONES par djgab21
Source .NET (Dotnet) DIRECTDISKACCESS par XelectroX

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

Mars 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728
293031    

Consulter la suite du CalendriCode

 
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 : 0,406 sec (3)

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