Mass Move Batch file


  1. Posts : 5
    Windows 7 Ultimate x64
       #1

    Mass Move Batch file


    Hey All, I have a list of files that I need to move (cut and paste) from location to another location.

    Thanks in advance
      My Computer


  2. Posts : 16
    Windows 7 Professional x64, RHEL 5,6,7
       #2

    Hi, can you describe a bit more about what you need?

    By the sounds of what you've said, you have a text file containing a list of files to move?
      My Computer


  3. Posts : 5
    Windows 7 Ultimate x64
    Thread Starter
       #3

    Exactly JonM, i have a list of over than 3000 records and i want some of them (which already in list.txt) to be moved to another directory. (Cut and paste)
      My Computer


  4. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #4

    Here you are, Migooz. Just tweaked the batch script made in your previous thread.


    Code:
    :: th-378655.bat [TxtFileList] [DestinationPath]
    @echo off
    REM Move files/folders specified in a newline-delimited txtfile list to the location of 'DestinationPath'. 
     
    set "default_list_path=C:\Users\%USERNAME%\Desktop\ListOfFilesToMove.txt"
    set "default_destination_path=C:\Entries\in\ListOfFilesToMove.txt\will\be\moved\to\here" 
    set "overwrite=FALSE"
     
    if not "%~3"=="" echo Error: unexpected arguments& exit /b
    if not "%~2"=="" ( set "destination=%2" ) else ( set "destination="%DEFAULT_DESTINATION_PATH:"=%"" )
    if not "%~1"=="" ( set "list=%1" ) else ( set "list=%DEFAULT_LIST_PATH%" )
     
    if not exist "%LIST:"=%" echo Error: list could not be found& exit /b
    if not exist "%DESTINATION:"=%" echo Error: the destination path could not be found& exit /b
     
    set /a counter=0
    for /f "delims=" %%I in ('type "%LIST:"=%"') do (
        if exist "%%~fI" (
            if exist "%DESTINATION:"=%\%%~nxI" (
                if /i "%OVERWRITE%"=="TRUE" (
                    set /a counter+=1
                    move /y "%%~fI" "%DESTINATION:"=%" >NUL
                ) else (
                    echo The path "%DESTINATION:"=%\%%~nxI" already exists.
                )
            ) else (
                set /a counter+=1
                move "%%~fI" "%DESTINATION:"=%" >NUL
            )
        ) else (
            echo No such item "%%~I".
        )
    )
     
    echo.& echo %COUNTER% files or folders were moved.
      My Computer


  5. Posts : 5
    Windows 7 Ultimate x64
    Thread Starter
       #5

    thanks Pyprohly


    thanks Pyprohly for your great support, but i cant move them to other directory other than C: is there something wrong
    Last edited by migooz; 22 Aug 2015 at 11:04. Reason: in complete solution
      My Computer


  6. Posts : 721
    Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
       #6

    Could you elaborate on the issue? The script moves files to other drives well for me.
      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 15:20.
Find Us