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

Author Topic: Re: Need batch file to move files  (Read 2368 times)

0 Members and 1 Guest are viewing this topic.

WillyW

    Topic Starter


    Specialist
  • Thanked: 29
  • Experience: Experienced
  • OS: Windows XP
Re: Need batch file to move files
« on: March 23, 2007, 10:54:54 AM »
Quote
I have a ListA.txt doc with a list of files located in C:\batch_A and I need only the files listed in the ListA.txt doc moved from C:\batch_A to C:\batch_B  can anyone help?  This is my first attempt at trying to create a batch file.  :-?


I see no one has replied yet.    Hang in there,  someone will be along shortly.  


In the meantime,  if you are hanging around hoping for a quick reply:

We will assume for now that you are using WindowsXP.    Please confirm that.

I don't have XP,  so I'm not going to try to directly answer your question.    I do believe it is possible to do what you want though.
You might like to spend some time now reading up on:
http://www.computerhope.com/forhlp.htm
as that is what I think you will be using.

As you read through that,  eventually you will come to:
"...Processing consists of reading in the file, breaking it up into individual lines of text and then parsing each line into zero or more tokens. The body of the for loop is then called with the...."  .
Sound like part of what you need?

Another trick, if you are waiting for one of the XP "dos" wizards to appear here -     use the Search function on this forum.    Look for key words like    delims     and/or    tokens.      You'll find posts with discussion of the    for    command.     You might pick up some clues toward your solution that way.

You said this is your first attempt at batch files.   :)      Hang in there....  don't feel swamped by the stuff you find and read here.
Somebody that has done it before can advise you.


.



diablo416

  • Guest
Re: Need batch file to move files
« Reply #1 on: March 23, 2007, 12:12:51 PM »
cd\batch_B
%\file1.doc
%\file2.doc
%\file3.doc
%\file4.doc
%\file5.doc

In your document you have with the file names , put a % in very front of all of them.. and use replace
in notepad to change % to copy c:\batch_a , after you switched into the c:\batch_b directory.


ghostdog74



    Specialist

    Thanked: 27
    Re: Need batch file to move files
    « Reply #2 on: March 23, 2007, 08:32:37 PM »
    please fine tune on your own environment
    Code: [Select]
    @echo off
    c:
    cd Batch_A

    for /F %%i in (c:\ListA.txt) do (

           echo %%i
          move %%i c:\Batch_B
    )