1
I have one folder on my desktop Test
, and in this folder I have two folders, WorkingFolder\Bilder
and Station 1
. So the structure looks like this:
Test\WorkingFolder\Bilder Test\Station 1
Within Test\
(the main folder) I have the batch file. I need to be able to move or copy the .jpg
files from Test\Station 1
into Test\WorkingFolder\Bilder
. For this I have been using XCopy
.
The problem is that I CANNOT use the name of the copy-from folder in XCOPY
, because the batch file will be used on several similarily structured folders, but with different path names. So I have been trying to use %~dp0
instead:
My code is:
md WorkingFolder\Bilder
xcopy /s "%~dp0\*.jpg" WorkingFolder\Bilder\
What I try to write is, copy all .jpg
within the subfolders of %~dp0
, %~dp0
being the folder where the batch file is in, and its subfolder where the images are located Station 1
, and put them in WorkingFolder\Bilder
.
Problem is no files are copied. Only when I DIRECTLY refer to Station 1
in Xcopy
, then the files are copied. I need to be able to refer to all subdirectories to %~dp0
and not like subdirectories to %~dp0\example
.
Please help me!
Not a solution, but you forgot to include
%~dp0
in your destination directory... – aschipfl – 2019-09-30T11:40:58.560