Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Error message when files not found  (Read 2628 times)

0 Members and 1 Guest are viewing this topic.

Tigers!

    Topic Starter


    Rookie

    Error message when files not found
    « on: November 26, 2009, 05:33:31 PM »
    Gudday all
    My code has been loaded onto the server and is working except for two (2) teensy problems that users have found. The problem occurs when no .spl files are present in the folder
    Code: [Select]
    echo finding spl files
    rem *** Extract all .SPL files ***
    rem dir D:\Archives\E20_120_AU\ArchiveCreator\Errors\*.spl /b > SPLfiles.txt
    dir !file_path!*.spl /b > SPLfiles.txt
    echo finished finding spl files
    .....
    del SPLfiles*.txt
    (the echo messages are for me)
    When no .spl files are found an error message occurs
    Quote
    File not found
    and the temporary file SPLfiles.txt is not deleted as it should be.

    Why is the message 'File not found' being generated? I do not want the code to fail if no .spl files are found.
    Or more particularly can I stop it?
    And why would the file not be deleted if indeed the non-deletion is due to the error message?

    Salmon Trout

    • Guest
    Re: Error message when files not found
    « Reply #1 on: November 27, 2009, 12:30:23 AM »
    Code: [Select]
    echo finding spl files
    rem *** Extract all .SPL files ***
    rem dir D:\Archives\E20_120_AU\ArchiveCreator\Errors\*.spl /b > SPLfiles.txt
    if exist "!file_path!*.spl" (
        dir !file_path!*.spl /b > SPLfiles.txt
        echo finished finding spl files
        ) else (
        echo No .spl files found
        )
    .....
    del SPLfiles*.txt

    Tigers!

      Topic Starter


      Rookie

      Re: Error message when files not found
      « Reply #2 on: November 29, 2009, 02:59:21 PM »
      ST
      Thank you.
       :( So much to learn.