P
P
passstrada2020-06-18 16:27:20
cmd/bat
passstrada, 2020-06-18 16:27:20

BAT, How to copy files with folders by full paths?

First: copy the folder with all files and folders "C:\Data" to the folder "C:\papka1"

Second: there is a list of files and folders with paths located in "C:\DATA":

spoiler

C:\Data\3d\Maps\28_rock_rc\SpeedTree\palms\images\palm_trunk.dx11.dds.dvpl
C:\Data\3d\Maps\28_rock_rc\stones\images\karelia_tiletex_blue.dx11.dds.dvpl
C:\Data\3d\Maps\28_rock_rc\stones\images\karelia_tiletex_blue.tex.dvpl
C:\Data\3d\Maps\29_skit_sk\work
C:\Data\3d\Maps\29_skit_sk\work\images
C:\Data\3d\Maps\29_skit_sk\work\images\yamato_01.dx11.dds.dvpl
C:\Data\3d\Maps\29_skit_sk\work\images\yamato_01.tex.dvpl
C:\Data\3d\Maps\29_skit_sk\work\images\yamato_02.dx11.dds.dvpl
C:\Data\3d\Maps\29_skit_sk\work\images\yamato_02.tex.dvpl
C:\Data\3d\Maps\34_forgecity_fc\buildings\images\bld_metlife.dx11.dds.dvpl
C:\Data\3d\Maps\34_forgecity_fc\buildings\images\bld_tower_plant.dx11.dds.dvpl
C:\Data\3d\Maps\34_forgecity_fc\buildings\images\build_1.dx11.dds.html
C:\Data\3d\Maps\34_forgecity_fc\buildings\images\build_2.dx11.dds.txt
C:\Data\3d\Maps\34_forgecity_fc\buildings\images\build_3.dx11.dds.gif
C:\Data\3d\Maps\34_forgecity_fc\buildings\images\build_4.dx11.dds.dvpl
C:\Data\3d\Maps\34_forgecity_fc\buildings\images\chrysler_building.dx11.dds.dvpl
C:\Data\3d\Maps\34_forgecity_fc\landscape\grass\forgecity_GrassMap.dx11.dds.dvpl
C:\Data\3d\Maps\hangar_prem_2018_birthday_6
C:\Data\3d\Maps\hangar_prem_2018_birthday_6\birthday_5

Mix these files with folders (that is, do not lose folder structures (even if they are listed)), they need to be copied along the path "C:\papka2"
This list can be used as in the batch file itself, or as a reference to a .txt file .
+ There are about 5000 lines of files and folders in the list, and therefore, it is desirable to get on the command line what for example (19 out of 19 lines copied), if not all lines, show which ones.

PS I used to copy files with a batch file that finds new files no older than 24 hours, and left new files in the "orig" folder:
spoiler
@echo off
set src=C:\orig
set dst=C:\bk
robocopy "%src%" "%dst%" /minage:1 /copyall /move /e
pause

But not always all files were copied.
Now there are file paths and I want to copy for each file, for better file tracking.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
passstrada, 2020-06-18
@passstrada

Solution:
First:
xcopy "C:\Data" "C:\papka1" /e /h /k /q /r /c /y
Second:
@echo off
for /f "delims= eol=" %%f in ( 'type list.txt') do (
if exist "%%f\" (
robocopy "%%~dpf\" "C:\papka2%%~pf\" /xf * /e /njh /njs /v /log+ :log.txt
) else ( robocopy "%%~dpf\" "C:\papka2%%~pf\" /fp /njh /njs /ns /nc /v /log+:log.txt "%%~nxf" )
)

R
res2001, 2020-06-18
@res2001

See teamxcopy /?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question