IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Entrée/Sortie Java Discussion :

[File] partition


Sujet :

Entrée/Sortie Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Inscrit en
    Avril 2004
    Messages
    15
    Détails du profil
    Informations forums :
    Inscription : Avril 2004
    Messages : 15
    Par défaut [File] partition
    bonjour

    Je developpe une petite application qui doit trouver un fichier sur n'importe quel partition.

    Hors je ne sais pas sur quel partition se trouve le fichier.

    Comment puis-je récupérer la liste des noms des partitions

    la liste serait par exe^mple c: d: f: ....


    merci d'avance

  2. #2
    Expert confirmé
    Avatar de le y@m's
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Février 2005
    Messages
    2 636
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Février 2005
    Messages : 2 636
    Par défaut
    la methode listRoots de la classe File pourrait t'interresser :

    Citation Envoyé par doc api
    listRoots

    public static File[] listRoots()

    List the available filesystem roots.

    A particular Java platform may support zero or more hierarchically-organized file systems. Each file system has a root directory from which all other files in that file system can be reached. Windows platforms, for example, have a root directory for each active drive; UNIX platforms have a single root directory, namely "/". The set of available filesystem roots is affected by various system-level operations such as the insertion or ejection of removable media and the disconnecting or unmounting of physical or virtual disk drives.

    This method returns an array of File objects that denote the root directories of the available filesystem roots. It is guaranteed that the canonical pathname of any file physically present on the local machine will begin with one of the roots returned by this method.

    The canonical pathname of a file that resides on some other machine and is accessed via a remote-filesystem protocol such as SMB or NFS may or may not begin with one of the roots returned by this method. If the pathname of a remote file is syntactically indistinguishable from the pathname of a local file then it will begin with one of the roots returned by this method. Thus, for example, File objects denoting the root directories of the mapped network drives of a Windows platform will be returned by this method, while File objects containing UNC pathnames will not be returned by this method.

    Unlike most methods in this class, this method does not throw security exceptions. If a security manager exists and its SecurityManager.checkRead(java.lang.String) method denies read access to a particular root directory, then that directory will not appear in the result.

    Returns:
    An array of File objects denoting the available filesystem roots, or null if the set of roots could not be determined. The array will be empty if there are no filesystem roots.

    Since:
    1.2
    Je ne répondrai à aucune question technique par MP.

    Pensez aux Tutoriels et aux FAQs avant de poster ;) (pour le java il y a aussi JavaSearch), n'oubliez pas non plus la fonction Rechercher.
    Enfin, quand une solution a été trouvée à votre problème
    pensez au tag :resolu:

    Cours Dvp : http://ydisanto.developpez.com
    Blog : http://yann-disanto.blogspot.com/
    Page perso : http://yann-disanto.fr

  3. #3
    Expert éminent
    Avatar de adiGuba
    Homme Profil pro
    Développeur Java/Web
    Inscrit en
    Avril 2002
    Messages
    13 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur Java/Web
    Secteur : Transports

    Informations forums :
    Inscription : Avril 2002
    Messages : 13 938
    Billets dans le blog
    1
    Par défaut
    Salut,


    Tu peux utiliser la méthode getRoots() de FileSystemView...

    Elle te renvoit l'élément de base de l'architecture de la machine ('/' sous Unix/Linux, le 'Bureau' sous Windows, les différents disques sous DOS pur).

    a++

  4. #4
    Membre averti
    Inscrit en
    Avril 2004
    Messages
    15
    Détails du profil
    Informations forums :
    Inscription : Avril 2004
    Messages : 15
    Par défaut
    merci a vous


    je n'ai eu le temps que de tester le listRoots ca marche très bien


    encore merci

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [File system] créer une nouvelle partition logique
    Par Harry_polin dans le forum Framework .NET
    Réponses: 2
    Dernier message: 13/08/2007, 23h20
  2. Différence file system et raw partition
    Par frutix dans le forum Administration système
    Réponses: 1
    Dernier message: 03/02/2006, 14h18
  3. A propos des 'File management Functions' de Windows
    Par znaidi dans le forum Windows
    Réponses: 3
    Dernier message: 01/04/2003, 16h01
  4. Problème montage partition Win sous RedHat ??
    Par baba dans le forum Administration système
    Réponses: 6
    Dernier message: 18/01/2003, 11h26
  5. recupèrer file d'attente d'impression
    Par magic corp. dans le forum Langage
    Réponses: 2
    Dernier message: 25/09/2002, 14h12

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo