views:

37

answers:

3

Hi, I want to store the URL of all files with same extension in specific 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)

+1  A: 

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.

akf
A: 

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.

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

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

marcus