O
O
other_letter2015-01-14 15:22:36
cmd/bat
other_letter, 2015-01-14 15:22:36

There is a txt with a list of files (with paths). How to copy and rename?

Through a network search, I find all the places where there is a certain PIC.jpg I find a
lot of them, they are all in a list like:
\\comp1\users\1\pic.jpg
\\comp2\users\2\pic.jpg
The task is to backup these files. But since the file name is the same everywhere, you need to rename it somehow. In principle, the username (i.e. profile name) should do.
How?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Spetros, 2015-01-14
@Spetros

How did you try to solve? What has already been done?
The question looks like a task for some freelance site.

O
other_letter, 2015-01-14
@other_letter

I tried the usual robocopy. Everything is OK, the only problem is with the renaming.

L
ldv, 2015-01-14
@ldvldv

@echo off
setlocal EnableDelayedExpansion
for /F %%i in (files.txt) do (
 set a="%%i"
 copy "%%i" "!a:\=-!"
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question