Solved

how copy a file to the same directory  robocopy

Posted on 2015-02-13
12
207 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 51

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 68

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
 
LVL 13

Expert Comment

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

Expert Comment

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

~bp
0
 
LVL 23

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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

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

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 68

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 68

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
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 …
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now