2025年5月7日 星期三

輸出拖曳資料夾中所有檔案 dir all subfolder files in specific folder by dragging

 rem @ECHO OFF

SET targetPath="%~1"

SET ToolPath=%~dp0


REM Method 0: work fine

REM FOR /F "delims=" %%I IN ('cmd /c echo %targetPath%') do SET deepest_folderName=%%~nxI


FOR /F "delims=" %%I IN (%targetPath%) do SET deepest_folderName=%%~nxI


dir %targetPath% /b /s /a-d > "%ToolPath%%deepest_folderName%-list.txt"

pause




-------------------------

tree /f>filelist.txt

-------------------------

reference:

https://superuser.com/questions/32771/list-all-files-in-all-subfolders

沒有留言:

張貼留言