Solved

how copy a file to the same directory  robocopy

Posted on 2015-02-13
12
234 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
  • 4
  • 3
  • 2
  • +2
12 Comments
 
LVL 53

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 69

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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 13

Expert Comment

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

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 69

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 69

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
An article on effective troubleshooting
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

810 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