开发者

Batch program to display files with complete directory

开发者 https://www.devze.com 2022-12-25 14:41 出处:网络
I want to store the URL of all files with same extension in spe开发者_运维技巧cific directory to one Log file. IS there any batch command available for this.

I want to store the URL of all files with same extension in spe开发者_运维技巧cific directory to one Log file. IS there any batch command available for this.

Exapmle I want to copy all files with *.TXT extension into one log file with its directory extension(URL)


you could use:

for /f %a in ('dir /b *.TXT') do echo %~fsa >> myLog.txt

note that the >> will append to the file, or create one if one does not exist. This works well for a one-off, but you will want to properly initialize the file if you are running this often.


Could use the TREE command available by the Command Prompt http://www.easydos.com/tree.html however you can't limit it by what type of files it lists.


dir /a /s /b "DIRECTORY\*.txt" >logfile.log

/s is the trick with complete path, BUT includes subfolders to.

0

精彩评论

暂无评论...
验证码 换一张
取 消