Les Snippets

Connexion

Tester l'existance d'un répertoire

Niveau requis pour utiliser/comprendre cette source : 1 ( Débutant )
Créé le 16/11/2006 11:26:35 et initié par Drikce06 [Liste]
Date de mise à jour : 04/10/2008 16:21:01
Vue : 10108
Catégorie(s) : Fichier / Disque
Langages dispo pour ce code :
- VB 2005, VB.NET 1.x
- Java
- Delphi 5
- VB 2005
- VB6, VBA
- Javascript
- VB6, VBA



Langage : VB.NET 1.x , VB 2005
Date ajout : 16/11/2006
Posté par Drikce06 [Liste]
Sub DirectoryExists(ByVal DirectoryPath As String) 
If My.Computer.FileSystem.DirectoryExists(DirectoryPath) = False Then MsgBox("Le répertoire n'existe pas")
End Sub
'Exemple d'utilisation:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
DirectoryExists("C:\")
End Sub


Langage : Java
Date ajout : 16/12/2006
Posté par Twinuts [Liste]
File dir = new File("/home/twinuts");
if(dir.exists() && dir.isDirectory())
    System.out.println(dir + " est un répertoire existant");
else
    System.out.println(dir + " n'existe pas ou n'est pas un répertoire");
Langage : Delphi 5
Date ajout : 02/01/2007
Posté par cirec [Liste]
If DirectoryExists('C:\Windows\') Then 
  ShowMessage('Le répertoire existe') 
Else
  ShowMessage('Le répertoire n''éxiste pas');

Remarque :
Ne pas oublier de déclarer FileCtrl dans les Uses
Langage : VB 2005
Date ajout : 05/03/2007
Posté par cacalex [Liste]
DateMAJ : 27/03/2007

If System.IO.Directory.Exists("C:\Le\Chemin\Du\Dossier") Then


     MsgBox("Le dossier existe")
End If

Langage : VB6 , VBA
Date ajout : 06/03/2007
Posté par mortalino [Liste]
Private Declare Function PathIsDirectory Lib "shlwapi" Alias "PathIsDirectoryA" _
                        (ByVal pszPath As String) As Long

Private Function ExistFolder(sPath As String) As Boolean
    ExistFolder = CBool(PathIsDirectory(sPath))
End Function
Private Sub EXEMPLE()
    MsgBox ExistFolder("C:\WINDOWS")
End Sub
Langage : Javascript
Date ajout : 27/03/2007
Posté par bultez [Liste]

function RepExiste(repertoire)
{
    var fso=new ActiveXObject("Scripting.FileSystemObject");
    return(fso.FolderExists(repertoire));
}


Langage : VB6 , VBA
Date ajout : 04/10/2008
Posté par Charles Racaud [Liste]
DateMAJ : 04/10/2008
Private Const INVALID_HANDLE_VALUE = -1&
Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileW" ( _
  ByVal lpFileName As Long, lpFindFileData As AnyAs Long
Private Declare Function FindClose Lib "kernel32" ( _
  ByVal hFindFile As LongAs Long

Public Function ExisteDirectory(ByVal Path As StringAs Boolean
  Dim hSearch As Long, lpFindFileData As Long
  hSearch = FindFirstFile(StrPtr(Path), lpFindFileData)
  If Not hSearch = INVALID_HANDLE_VALUE Then
    ExisteDirectory = True
    Call FindClose(hSearch)
  End If
End Function

Snippets en rapport avec : Existe, Repertoire



Codes sources en rapport avec : Existe, Repertoire

{JAVA / J2EE} ENVOI D'UNE ARBORESSENCE EN JAVA VERS SERVEUR FTP
pas besoin d'acheter l'API editftpjPro qui coute 500 Dollars pour envoyer une arborescence complète ...

{C / C++ / C++.NET} LISTER LES FICHIERS D'UN REPERTOIRE + FILTRES
Programmé sous Linux. Compatible windows. Liste les fichiers d'un répertoire come indiqué dans le...

{C / C++ / C++.NET} [WIN32] PETIT RÉPERTOIRE TÉLÉPHONIQUE ET AUTRES (GESTION LISTVIEW)
Bonjour à tous. Bon, voilà une petite appli tout "bête". Elle permet d'enregistrer les coordonnées ...

{Delphi} DIRECTORYDLG (BOÎTE DE DIALOGUE CHOIX DU DOSSIER)
Bonjour, eh bien, j'en avais assez de devoir créer ma boîte de dialogue à chaque fois que je dois s...

{Delphi} MASQUER UN REPERTOIRE
Cette modeste source permet de masquer un répertoire, en changeant son icone par une icone tran...

{Python} MON REPERTOIRE
Salut Encore pour mon initiation à wxpython j'ai réalisé cette aplli. Envoyer moi assez de comment...

{Visual Basic, VB6, VB.NET, VB 2005} DIRLISTING - LISTER UN DOSSIER ET SES SOUS DOSSIERS TRES RAPIDEMENT
Cette classe vous offre un moyen simple et rapide de lister le contenu d'un repertoire. Elle est in...

{C / C++ / C++.NET} EXPLORATEUR DE FICHIER
Classe CRepExplorer Permet de créé un arbre avec tous les sous dossier et fichier d'un dossier P...

{C / C++ / C++.NET} [DEVC++] PROTEGER L'ACCES À UN RÉPERTOIRE
C'est Quoi ? Appli qui sert à proteger un repertoire. En fait ça renomme un ré...

{IRC} [XCHAT] REPERTOIRE DE CONFIG
Bonjour à tous, voici une source en python pour le client XChat. Pour qu'elle puisse tourner proprem...