Solved

how copy a file to the same directory  robocopy

Posted on 2015-02-13
12
281 Views
Last Modified: 2015-02-16
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
0
Comment
Question by:edo60
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2
12 Comments
 
LVL 56

Accepted Solution

by:
Bill Prew earned 167 total points
ID: 40608366
Not sure exaclty what you are after, but if you just want the files in the root of Z: you can do:

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

Open in new window


If you want them in the same folder then you can do:

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

Open in new window


~bp
0
 

Author Comment

by:edo60
ID: 40608421
o man, i dont think i can manipulate the original .txt
to that way
0
 
LVL 70

Expert Comment

by:Qlemo
ID: 40608611
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?
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 13

Expert Comment

by:Santosh Gupta
ID: 40608722
Please explain your question .....
0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 40608810
Yes, please explain further.

~bp
0
 
LVL 24

Assisted Solution

by:NVIT
NVIT earned 167 total points
ID: 40608861
My guess...

He has a huge .txt file with filenames like:

f:\Carpetas Compartidas\pegar.TXT"
f:\Carpetas Compartidas\pipe.TXT"
f:\Carpetas Compartidas\REQUISvv.DOC"
f:\Carpetas Compartidas\1 PLANEACION\LISTADO PROCEDIMIENTOS.DOC"

...and he wants to do the robocopy thing.

... and he thinks he has to revise the original .txt to the way Bill showed.  With all those perfect spaces and stuff... Yikes. hehe.

Just a guess...
0
 

Author Comment

by:edo60
ID: 40609110
thats it!!
newvillage
0
 
LVL 24

Expert Comment

by:NVIT
ID: 40609141
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

0
 
LVL 70

Assisted Solution

by:Qlemo
Qlemo earned 166 total points
ID: 40609510
RoboCopy seems to be oversize here. XCopy should do better for single files.
0
 

Author Comment

by:edo60
ID: 40613059
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   "
0
 
LVL 70

Expert Comment

by:Qlemo
ID: 40613076
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?
0
 

Author Comment

by:edo60
ID: 40613142
it does!!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question