I need to get the relative filepath of files with bat.
The folder structure
file.bat
- folder1
-- subfolder1
----- abc.image
----- def.image
-- subfolder2
---- more.image
- folder2
-- subfolder1
---- alsoimages.image
-- subfolder2
For abc.image, I'd like to get the name of the folder (here e.g. folder1) and the combination folder+subfolder (here e.g. folder1/subfolder1)
I looked at this post: batch programming - get relative path of file but I cant make it work for me. The output keeps giving me too many hierachies.
What I want to do ultimately is this:
set "prefix=td"
set "file=list_of_images.xml"
echo ^<?xml version="1.0" encoding="UTF-8" standalone="yes"?^> > %file%
echo ^<files^> >> %file%
for /r %%x in (*.image) do (
echo ^<file folder="(here e.g. folder1)" subfolder="(here e.g. folder1/subfolder1)" id="%prefix%%%~nx" type="image" /^> >> %file%
)
echo ^</files^> >> %file%
Thanks for help and tips!