Batch program to display files with complete directory
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.
精彩评论