Link to home
Start Free TrialLog in
Avatar of Ernesto
ErnestoFlag for Mexico

asked on

how copy a file to the same directory robocopy

hi all

i want to achive this

 robocopy  f:\Carpetas Compartidas\pegar.TXT   /mir z:\
robocopy f:\Carpetas Compartidas\pipe.TXT   /mir z:\
robocopy f:\Carpetas Compartidas\REQUISvv.DOC    /mir z:\
robocopy f:\Carpetas Compartidas\1 PLANEACION\LISTADO PROCEDIMIENTOS.DOC   /mir z:\

is a huge txt file that i need to replace documents to the same route in drive z:
is any way to do this whit robocopy
tsm you experts
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ernesto

ASKER

o man, i dont think i can manipulate the original .txt
to that way
If you want to change something, you need to change the way the copy is performed. With "original .txt", do you mean the file containing the commands?
Avatar of Santosh Gupta
Santosh Gupta

Please explain your question .....
Yes, please explain further.

~bp
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ernesto

ASKER

thats it!!
newvillage
Bill's 2nd solution should work for you. Still, you'd need to revise that huge .txt file somehow. As an alternative, maybe this will help....

Notes:
- Copy the code below and save to a .bat file of your choice.
- Revise set fn=HugeFile.txt to match your filename of your .txt file. If the file is in a certain folder, you can add the folder name, too. e.g. c:\user\me\documents\hugefile.txt
- This version uses ECHO robocopy for testing (visual) purposes. When you are satisfied that it looks like it will work, remove the ECHO in front of robocopy and save the .bat file. Then run it live.
- When running it live, let me know if you experience errors. Errors will show in the HugeFileCopy.log
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION

set fn=HugeFile.txt

for /f "tokens=*" %%A in (%fn%) do (
  set dv=%%~dA
  set pt=%%~pA
  set f=%%~nA%%~xA
  ECHO robocopy "!dv!!pt!" "z:!pt!" "!f!" /SECFIX /R:3 /W:3 /log+:HugeFileCopy.log
)
goto :eof

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ernesto

ASKER

i do it whit a copy
tsm all

copy "f:\Carpetas Compartidas\pegar.TXT   "       "z:\Carpetas Compartidas\pegar.TXT   "
copy "f:\Carpetas Compartidas\pipe.TXT   "       "z:\Carpetas Compartidas\pipe.TXT   "
copy "f:\Carpetas Compartidas\REQUISvv.DOC   "       "z:\Carpetas Compartidas\REQUISvv.DOC   "
copy "f:\Carpetas Compartidas\1 PLANEACION\LISTADO PROCEDIMIENTOS.DOC   "       "z:\Carpetas Compartidas\1 PLANEACION\LISTADO PROCEDIMIENTOS.DOC   "
copy "f:\Carpetas Compartidas\1 PLANEACION\PLANEACION INTEGRAL.DOC   "       "z:\Carpetas Compartidas\1 PLANEACION\PLANEACION INTEGRAL.DOC   "
copy "f:\Carpetas Compartidas\1 PLANEACION\Portada.DOC   "       "z:\Carpetas Compartidas\1 PLANEACION\Portada.DOC   "
copy "f:\Carpetas Compartidas\1 PLANEACION\SEPARADOR.DOC   "       "z:\Carpetas Compartidas\1 PLANEACION\SEPARADOR.DOC   "
copy "f:\Carpetas Compartidas\5106 NORMAS APLICABLES GASODUCTOS\NOM\Anexo 13 Codigos y Normas aplicables_ Rev 2.DOC   "       "z:\Carpetas Compartidas\5106 NORMAS APLICABLES GASODUCTOS\NOM\Anexo 13 Codigos y Normas aplicables_ Rev 2.DOC   "
copy "f:\Carpetas Compartidas\5106 NORMAS APLICABLES GASODUCTOS\NOM\Anexo 13 NOM aplicables.DOC   "       "z:\Carpetas Compartidas\5106 NORMAS APLICABLES GASODUCTOS\NOM\Anexo 13 NOM aplicables.DOC   "
copy "f:\Carpetas Compartidas\5106 NORMAS APLICABLES GASODUCTOS\NOM\NOM-105-STPS-1994 CANCELADA.DOC   "       "z:\Carpetas Compartidas\5106 NORMAS APLICABLES GASODUCTOS\NOM\NOM-105-STPS-1994 CANCELADA.DOC   "
copy "f:\Carpetas Compartidas\5106 NORMAS APLICABLES GASODUCTOS\NOM\NOM-114-STPS-1994 CANCELADA.DOC   "       "z:\Carpetas Compartidas\5106 NORMAS APLICABLES GASODUCTOS\NOM\NOM-114-STPS-1994 CANCELADA.DOC   "
copy "f:\Carpetas Compartidas\APOLONIO\AGM.DOC   "       "z:\Carpetas Compartidas\APOLONIO\AGM.DOC   "
Very inconvenient, as you have write anything twice, but if that works for you ...
However, I doubt it does, or are those trailing spaces part of the file name?
Avatar of Ernesto

ASKER

it does!!