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

Scripts/Batch Discussion :

récupération de fichier en fonction de leur contenu


Sujet :

Scripts/Batch

  1. #21
    Débutant  
    Avatar de koKoTis
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 438
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 438
    Points : 2 415
    Points
    2 415
    Par défaut
    tu a bien mis se script ?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    @echo off
    
    
    
    set vrRepSource=dos2
    
    set vrLog=log_21.log
    
    echo --- Les fichier contenants 21 … la troisiŠme ligne --- >"%vrLog%"
    echo. >>"%vrLog%"
    
    for /r "%vrRepSource%\" %%i in (*.txt) do set vrChmFch=%%i& call :21test
    goto fin
    
    :21test
    
    for /f "tokens=* delims=" %%i in ('type "%vrChmFch%"') do set vrLign=%%i& call :test21
    
    
    :test21
    
    if "%vrLign:~0,2%"=="21" echo %vrChmFch%
    if "%vrLign:~0,2%"=="21" echo %vrChmFch%>> "%vrLog%"
    
    goto :eof
    
    :fin
    
    
    pause>nul
    ah mais au fait, à la ligne:
    il faut que tu remplace dos2 par le chemin du dossier qui contient tes fichiers txt

  2. #22
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 50
    Points : 28
    Points
    28
    Par défaut
    Dernier souci?
    J'ai bien remplacé dos2 par mon chemin "C:\Documents and Settings\yguerin\Bureau\GABARITS\UNION_GABARITS\*.txt", mais le log renvoyé est le suivant :
    --- Les fichier contenants 21 … la troisiŠme ligne ---
    C'est bien une réponse, mais je ne m'attendais pas à celle-là?

  3. #23
    Débutant  
    Avatar de koKoTis
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 438
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 438
    Points : 2 415
    Points
    2 415
    Par défaut
    a tu bien des fichier qui contiennent 21 ?

  4. #24
    Débutant  
    Avatar de koKoTis
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 438
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 438
    Points : 2 415
    Points
    2 415
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    @echo off
    
    
    
    set vrRepSource=dos2
    
    set vrLog=log_21.log
    
    echo --- Les fichier contenants 21 … la troisiŠme ligne --- >"%vrLog%"
    echo. >>"%vrLog%"
    
    for /r "%vrRepSource%\" %%i in (*.txt) do set vrChmFch=%%i& call :21test
    goto fin
    
    :21test
    
    for /f "skip=2 tokens=* delims=" %%i in ('type "%vrChmFch%"') do set vrLign=%%i& goto test21
    
    
    :test21
    
    if "%vrLign:~0,2%"=="21" echo %vrChmFch%
    if "%vrLign:~0,2%"=="21" echo %vrChmFch%>> "%vrLog%"
    
    goto :eof
    
    :fin
    
    
    pause>nul

  5. #25
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 50
    Points : 28
    Points
    28
    Par défaut
    oui, je fais le test avec 4 fichiers dont celui que je t'ai adressé

  6. #26
    Débutant  
    Avatar de koKoTis
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 438
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 438
    Points : 2 415
    Points
    2 415
    Par défaut
    ben je comprend pas chez moi ca fonctionne

  7. #27
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 50
    Points : 28
    Points
    28
    Par défaut
    Le fait qu'il y ait des blancs dans mon chemin ne pourrait-il pas être la cause de ce problème?

  8. #28
    Débutant  
    Avatar de koKoTis
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 438
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 438
    Points : 2 415
    Points
    2 415
    Par défaut
    non puis-que j'ai mi les guillemet la ou il faut

  9. #29
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 50
    Points : 28
    Points
    28
    Par défaut
    Je ne comprends pas pourquoi ça fonctionne chez toi et chez moi j'ai un fichier log me remettant uniquement la phrase :
    Les fichier contenants 21 … la troisiŠme ligne

  10. #30
    Débutant  
    Avatar de koKoTis
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 438
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 438
    Points : 2 415
    Points
    2 415
    Par défaut
    chez moi le log contien:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    --- Les fichier contenants 21 … la troisiŠme ligne --- 
     
    C:\Documents and Settings\lunnatick\Bureau\dos 2\0006GA.txt
    C:\Documents and Settings\lunnatick\Bureau\dos 2\Copie (2) de 0006GA.txt
    J'ai fait plusieur copie du fichier txt que tu a poster, et j'ai remplacer 21 dans certain fichier, il n'en reste que 2 avec 21

  11. #31
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 50
    Points : 28
    Points
    28
    Par défaut
    j'ai remplacé ton dos2 par "C:\Documents and Settings\yguerin\Bureau\GABARITS" c'est bien ce qu'il faut faire??

  12. #32
    Débutant  
    Avatar de koKoTis
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 438
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 438
    Points : 2 415
    Points
    2 415
    Par défaut
    oui c'est bien ca

  13. #33
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 50
    Points : 28
    Points
    28
    Par défaut
    Voilà mon batch, que je leance en double cliquant dessus (normal quoi)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    @echo off
    
    
    
    set vrRepSource= C:\Documents and Settings\yguerin\Bureau\GABARITS\UNION_GABARITS
    set vrLog=log_21.log
    
    echo --- Les fichier contenants 21 … la troisiŠme ligne --- >"%vrLog%"
    echo. >>"%vrLog%"
    
    for /r "%vrRepSource%\" %%i in (*.txt) do set vrChmFch=%%i& call :21test
    goto fin
    
    :21test
    
    for /f "skip=2 tokens=* delims=" %%i in ('type "%vrChmFch%"') do set vrLign=%%i& goto test21
    
    
    :test21
    
    if "%vrLign:~0,2%"=="21" echo %vrChmFch%
    if "%vrLign:~0,2%"=="21" echo %vrChmFch%>> "%vrLog%"
    
    goto :eof
    
    :fin
    
    
    pause>nul
    Je ne comprends pas????

  14. #34
    Débutant  
    Avatar de koKoTis
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 438
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 438
    Points : 2 415
    Points
    2 415
    Par défaut
    la tu a mi un espace en trop:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    set vrRepSource= C:\Documents and Settings\yguerin\Bureau\GABARITS\UNION_GABARITS
    fait ca:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    set vrRepSource=C:\Documents and Settings\yguerin\Bureau\GABARITS\UNION_GABARITS

  15. #35
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Juillet 2008
    Messages
    50
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2008
    Messages : 50
    Points : 28
    Points
    28
    Par défaut
    Je venais juste de corriger et je postais pour te dire que tout était ok.

    Un grand merci pour ton aide. Je cloture le post

  16. #36
    Débutant  
    Avatar de koKoTis
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 438
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 438
    Points : 2 415
    Points
    2 415
    Par défaut
    ok parfait

+ Répondre à la discussion
Cette discussion est résolue.
Page 2 sur 2 PremièrePremière 12

Discussions similaires

  1. [Batch] Supprimer des fichiers en fonction de leur date
    Par charlix dans le forum Scripts/Batch
    Réponses: 55
    Dernier message: 05/10/2015, 17h18
  2. [Batch] Renommer des fichiers en fonction de leur contenu
    Par seemax dans le forum Scripts/Batch
    Réponses: 3
    Dernier message: 04/04/2012, 14h24
  3. Comment dimensionner JFrame ou JPanel en fonction de leur contenu
    Par L4BiN dans le forum Agents de placement/Fenêtres
    Réponses: 7
    Dernier message: 15/02/2007, 14h49
  4. Réponses: 4
    Dernier message: 03/09/2006, 19h12
  5. Récuperer des fichiers en fonction de leur ancienneté
    Par julien000 dans le forum Langage
    Réponses: 3
    Dernier message: 24/07/2006, 17h09

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