Reputation: 123
I want to search *.cpp files in current directory and want to save the file name in *.TXT file. I did this by using the Batch command
dir |find ".cpp" > Listfile.txt
But there I am getting file name with entire paramenters like created date and size.
My need is I want only file name
Current output
06/25/2010 06:17 PM 950 4mLinuxMachine.cpp
06/28/2010 03:41 PM 4,236 Linux11.cpp
Need Output
4mLinuxMachine.cpp
Linux11.cpp
Please help Thanks
Upvotes: 1
Views: 9602
Reputation: 11
Search from the file explorer and use this shell extension to copy from the context menu: http://grebulon.com/software/copylocation.php
"This shell extension adds the ability to copy file and folder names from the Windows Explorer window to the clipboard. Simply select the file(s) whose name you want to copy, right-click and select "Copy File Path" or "Copy File Name" from the context menu. Then paste to any editor. Copy File Path - copies the entire path to the file. Copy File Name - copies only the file name without the folder."
Upvotes: 1
Reputation: 212979
Try:
dir /b | find ".cpp" > Listfile.txt
or better still:
dir /b *.cpp > Listfile.txt
Upvotes: 6
Reputation: 104080
If you don't mind installing or using cygwin tools, this task can be done like so:
find . -type f -name '*.cpp' -print > Listfile.txt
Upvotes: 1
Reputation: 11007
Use bare format: dir /B
dir /B |find ".cpp" > Listfile.txt
Othe options you can find using:
dir /?
Upvotes: 1