Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
This is a lighter, easier to understand script than the first part. Judago had came about helping me out with it but for some reason, it still aint working. Hope you guys can help me out! - Marie
The script below is 100% working. What I want to do is for the variable isoissue to pick up the data from an external list.txt file. The list.txt would have the following:
item1
item2
item3@echo off
Set "isoissue=item1"
Set "sourceDir=d:\edwin\work\autocopy\isometrics"
Set "TOLOCATION1Folder=d:\edwin\work\autocopy\TO_LOCATION1"
Set "TOLOCATION2Folder=d:\edwin\work\autocopy\TO_LOCATION2":: copy files TOLOCATION1Folder
For /F "Delims=" %%! in ('Dir "%sourceDir%\%isoissue%.i*" /b /s /a-d 2^>nul') do (@echo.%%! &(@xcopy "%%!" "%TOLOCATION1Folder%\" /i /y /h /f /c)):: copy files TOLOCATION2Folder
For /F "Delims=" %%! in ('Dir "%sourceDir%\%isoissue%.i*" /b /s /a-d 2^>nul') do (@echo.%%! &(@xcopy "%%!" "%TOLOCATION2Folder%\" /i /y /h /f /c))
:done
title,Done.......echo.&pause>nul
hopeless but trying

This is Judago's suggestion but it doesnt work :( hope you can carry on from here and check whats wrong with it..
@echo off
title AUTOMATED ISO COPYfor /f %%g in (d:\edwin\work\autocopy\list.txt) do call :body %%G
goto :eof
:body
Set "isoissue=%1"Set "sourceDir=d:\edwin\work\autocopy\isometrics"
Set "TOLOCATION1Folder=d:\edwin\work\autocopy\TO_LOCATION1"
Set "TOLOCATION2Folder=d:\edwin\work\autocopy\TO_LOCATION2":: copy files TOLOCATION1Folder
For /F "Delims=" %%! in ('Dir "%sourceDir%\%isoissue%.i*" /b /s /a-d 2^>nul') do (@echo.%%! &(@xcopy "%%!" "%TOLOCATION1Folder%\" /i /y /h /f /c)):: copy files TOLOCATION2Folder
For /F "Delims=" %%! in ('Dir "%sourceDir%\%isoissue%.i*" /b /s /a-d 2^>nul') do (@echo.%%! &(@xcopy "%%!" "%TOLOCATION2Folder%\" /i /y /h /f /c))
:done
title,Done.......echo.&pause>nul
goto :eof
hopeless but trying

Sorry, What I posted had a little mistake in it. Try changing:
This
for /f %%g in (d:\edwin\work\autocopy\list.txt) do call :body %%G
to this:
for /f %%g in (d:\edwin\work\autocopy\list.txt) do call :body %%gI accidentally mixed the case up on the for loop variable, %%g was set but %%G wasn't.

Hi Judago thanks for replying. Its working perfectly now.. i just edited the last part of that script and removed the echo.&pause at the end and it worked like a charm.. you rock!!!
hopeless but trying

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |