Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how copy a file to the same directory  robocopy

Posted on 2015-02-13
12
Medium Priority
?
317 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:Ernesto
  • 4
  • 3
  • 2
  • +2
12 Comments
 
LVL 59

Accepted Solution

by:
Bill Prew earned 668 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:Ernesto
ID: 40608421
o man, i dont think i can manipulate the original .txt
to that way
0
 
LVL 71

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
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!

 
LVL 13

Expert Comment

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

Expert Comment

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

~bp
0
 
LVL 25

Assisted Solution

by:NVIT
NVIT earned 668 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:Ernesto
ID: 40609110
thats it!!
newvillage
0
 
LVL 25

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 71

Assisted Solution

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

Author Comment

by:Ernesto
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 71

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:Ernesto
ID: 40613142
it does!!
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …

971 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