Batch File to Move a list of files.


  1. Posts : 2
    Windows Server 2008 R2
       #1

    Batch File to Move a list of files.


    Hey All, I just joined this forum to find some help on a specific topic that I've been researching for like two hours now on google. I have a list of 1300 files that I need to move from one location to another (move not copy). I've found this batch file created by Neutron16 which performs a Move but it's all gibberish to me. How would I modify it to move the files to location "C:\Archive" There's about 4,000 other files in the same folder.

    Thanks in advance
      My Computer


  2. Posts : 3,139
    Systems 1 and 2: Windows 7 Enterprise x64, Win 8 Developer
       #2

    Welcome to SF. That's a copy script. Changed it to a move script. You will need to specify the directory of origin. Also, change extension to "bat"
    Batch File to Move a list of files. Attached Files
      My Computer


  3. Posts : 2
    Windows Server 2008 R2
    Thread Starter
       #3

    Okay, I've researched the move script, this link gave a pretty good tutorial How To Move Files With A Batch File | mixeduperic.com however I need it to pull from a .txt list of all the filenames, I can change how the entries are separated if need be pipe or comma or a list like this:

    entry1.xml
    entry2.xml
    entry3.xml

    I'm able to output all of those through excel.

    Thanks for your help. And the kind welcome
      My Computer


  4. Posts : 3,371
    W10 Pro desktop, W11 laptop, W11 Pro tablet (all 64-bit)
       #4

    Here's a batch file that should do what you need:
    Code:
    @echo off
    if %1.==. goto usage
    if %2.==. goto usage
    if %3.==. goto usage
    FOR /F %%i in (%2) do move /Y %1\%%i %3\%%i
    goto xit
    :usage
    echo Usage - muv source_folder file_list.txt target_folder
    echo Example - muv c:\tmp data.txt d:\stuff
    :xit
    Save this into a file called muv.bat

    The /Y after the move command says you don't want to be prompted if the move will overwrite an existing file, change to /-Y if you want to be prompted before overwriting.
      My Computer


  5. Posts : 1
    Windows 7 Ultimate x64
       #5

    I can't seem to get this batch to work could you. Any additional information I might be missing?
      My Computer


  6. Posts : 6,285
    Windows 10 Pro X64
       #6

    Remove the echo off at the top then run it and post the error output here.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 03:01.
Find Us