Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I print all .pdf files names to an output file with command line?

This seems easy in Linux, but I'm trying to print the names of *.pdf files within a directory and its subdirectories to an output file. I have Perl installed on my Windows machine.

What's a simple way to do this?

like image 542
Jake Avatar asked Dec 23 '10 02:12

Jake


People also ask

Can you print a list of file names in a folder?

Select all the files, press and hold the shift key, then right-click and select Copy as path. This copies the list of file names to the clipboard. Paste the results into any document such as a txt or doc file & print that. Then open notepad, open tempfilename, and print it from there.

How do I get a list of files in a folder in cmd?

Click in the address bar and replace the file path by typing cmd then press Enter. This should open a black and white command prompt displaying the above file path. Type dir /A:D. /B > FolderList.


1 Answers

Not much different than Linux.

dir *.pdf > fileyouwant.txt

If you only want the filenames, you can do that with

dir/b *.pdf > fileyouwant.txt

If you also want subdirs,

dir/s/b *.pdf > fileyouwant.txt

If you aren't in that directory to start with

dir/s/b C:\Path\*.pdf > fileyouwant.txt
like image 85
boatcoder Avatar answered Oct 23 '22 02:10

boatcoder