No announcement yet.

batch help for renaming text in file

  • Filter
  • Time
  • Show
Clear All
new posts

  • batch help for renaming text in file

    Cd/DVD disc info's are stored in a ultra simple text files to allow for search and the users reqs are shot to the server into a indivualized %USER%REQ.txt file and allow us quik looking up for the item

    My problem is when the search returns a hit it also includes the Location/file
    which is what I wanted but every time I try and build a code for the server side Console to remove that reference I get nothing.. well everything removed. i.e. the code the USERS search gets and sends to me is--
    \\SERVER\ROOT\Disc Lists\LR Cab 1\Spindle 002\B007 Docs.txt:d:\CDFOLDER\Some Document.doc

    I've tried to get everything from the line start to :\ to be removed when the server batch runs [it should allow me to just flop the disk in once it removes the 'location' info leaving only 'd:\CDFOLDER\Some Document.doc' then the batch will move it to a temp location and add \\SERVER\TEMP\ & the doc name to the users server side ready grab list so when they connect it does it in the background.

    is there a Simple way to be able to load the %USER%Req.txt files existing as a list, to select which user to work?

    I don'y have the server side code.. i use test code first and it simply didn't work, and i am fine tuning the behaviors between the start.bat & the search file..
    I'd diffently be very greatfully of any help before i try n tackle it agian
    Last edited by wbsimsjr; 6th June 2010, 08:29.

  • #2
    Re: batch help for renaming text in file

    I'm not sure I understand all of it.

    Can the sample below be of any help,
    @echo off
    Set "myString=\\SERVER\ROOT\Disc Lists\LR Cab 1\Spindle 002\B007 Docs.txt:d:\CDFOLDER\Some Document.doc"
    For /f "tokens=1,* delims=:" %%a in ('echo.%myString%') do echo "%%b"

    This posting is provided "AS IS" with no warranties, and confers no rights.


    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts


    • #3
      Re: batch help for renaming text in file

      Many Thanks! It's been a crash course to say the least I will try this out.. I had just logged in to post an update.. I experimented with a few delim statements and thought I nailed it.. LOL i was wrong.. since some of my backups may be 3-4 folders deep I ended up with another round of giberish.. from the looks of your code .. me seez where I went wrong..
      I discovered a few things I needed the re-gurg'd info to include on the server side of the file, so instead of every new user request making an individual file for their wants.. it goes into a MasterRequestFile then the server batch processes the reqs and spits out the individual list for the Users

      the part I left out of the original post was that the users req file may contain upto 20 of
      \\SERVER\ROOT\Disc Lists\LR Cab 1\Spindle 002\B007 Docs.txt:d:\CDFOLDER\Folder\SomeDoc1.doc
      \\SERVER\ROOT\Disc Lists\LR Cab 1\Spindle 1\A124 Docs.txt:d:\CDFOLDER\Folder\SomeDoc1.doc
      \\SERVER\ROOT\Disc Lists\LR Cab 1\Spindle 010\C139 Music.txt:d:\CDFOLDER\Folder\SomeTune.mp3

      each disc is Dir'd into a txt file, the %%a being the return from findstr the %%b is the actual file info.. So Disc B007 is in Spindle 002 inside LR [LargeRight] Cab[inet] 01..
      the Server will spit out 2 files..
      a "pick list" of sorts goes to the PDA's or i can call it up at a PC in the room
      and a List of the files to copy off the CD/DVD...

      So when it is finished the batch will echo what disk to insert, copy the files, add it too the IntendedUsersPC.txt file and so on.. So all anyone has to do is press a key and put in discs


      • #4
        Re: batch help for renaming text in file

        Thanks Rems..
        this is what is the near end of what was needed
        for /f "delims=: tokens=1-3" %%a in (%PC%OLR.txt) do echo "%%a" "%%b" "%%c"
        I was trying to delim : and \ and it broke the line into too many variables which also wouldn't allow for folder variations on the Disc...

        Do ya have any tips on using the same (%PC%OLR.txt) file in an FTP script?
        I need sleep :-S .. Thanks Again!