문제

First question:

I can list path names & folder names, but I have a problem.

I don't need path names, look "<-- this":

C:\Users\Ad\Desktop\ready_pc\data\daiva\a\building <-- this.
C:\Users\Ad\Desktop\ready_pc\data\daiva\a\building\daiva.dds

My batch command:

dir /b /s > fileslist.txt

Another question:

I need to change imported file path names:

Imported:

C:\Users\Ad\Desktop\ready_pc\data\daiva\a\building\daiva.dds

Must be:

d:\another_work\ready_pc\data\daiva\a\building\daiva.dds

Any ideas?

도움이 되었습니까?

해결책

add another parameter /a-d. This means "Attribute: NoDir":

dir /b /s /a-d

EDIT (replacing string adapted to your needs):

@echo off
Setlocal EnableDelayedExpansion
for /f "tokens=*" %%i in (fileslist.txt) do (
 set line=%%i
 set line=!line:C:\Users\Ad\Desktop\=d:\another_work\!
 echo !line! >>newfile.txt
)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top