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

Author Topic: exclude files while deleting  (Read 2186 times)

0 Members and 1 Guest are viewing this topic.

blastman

    Topic Starter


    Hopeful

    exclude files while deleting
    « on: November 11, 2007, 08:53:04 AM »
    hey all,

    I'm writing a loop to do sereval tasks.

    I help support over 1000 tills and Pc's. they sometimes have errors in which I need to rebuild 'POS' folders to get the till program to run.

    This envoles

    1, copying the enitia contents of a dir to a remote machine's c:\pos folder. (no problem there)
    2, removing a few files from known loactions (no problem there)

    (this is the tricky bit)
    these POS folders have files called pos1.sts, pos1.err, pos1.tcf and pos1.cfg inside. The problem is they have these files for every till. ie, pos2, pos3, pos4, ect.....

    I need to remove all .sts, .err, .tcf and .cfg files but the ones not affilated with the till in question (ie, on till 1 i'd need to remove all pos2.*,  pos3.* ect...)

    I could do this by makeing the user enter the till number, use that as a lable and for each lable do whats required for the till.

    But i'd really like to just have one loop with values set for the different tills.

    example;

    goto %1           rem %1 being the till number you wish to run it for.

    :till1

    set /a till=pos1
    set /a ip=%2.12   rem %2 being the stores network address
    goto loop

    :till2

    set /a till=pos2
    set /a ip=%2.13
    goto loop

    :loop
    net use \\%2.11
    copy \\%2.11\c$\master.pos\*.* c:\pos\*.*

    del c:\%till%.lck
    del c:\pos\%till%.sts
    del c:\pos\%till%.err

    This is the bit i'm unsure of. - i'd like to remove all pos*.sts, .err, .tcf, .cfg files but ones that start %till%.
    goto fin


    :fin
    echo. Pos rebuild Complete :)
    exit


    any ideas??

    Blastman, you are the man. Thank You Very Much!!!!!!!!!