Copy filenames in a directory to a txt file?

July 25th, 2016

Anyone know how I can use Windows CMD to copy the file names/folders/sub-folders of a directory to a txt file but without the full path name? (just folder name’s and the file names)
e.g. I want the end txt file to say…..
Movies>
Thor
Man of Steel
Shutter Island
Inception
and not
C:/users/xxxxxxxx/desktop/My Movies/Movies/Thor
C:/users/xxxxxxxx/desktop/My Movies/Movies/Man of Steel
C:/users/xxxxxxxx/desktop/My Movies/Movies/Shutter Island
C:/users/xxxxxxxx/desktop/My Movies/Movies/Inception
……………..So can anyone help?

Answer #1
you can do a shell script if you have the skills for it. It’s actually pretty easy and straightforward if you have the knowledge. As simple as: “per line, print only the text from the last forward slash onward”
Answer #2
for /r %i in (*) do @echo %~ni
Lists ALL files and folders without extensions.
If you want the extensions, change %~ni to %~nxi
For batch file use, change all the % to %%
Answer #3
Could you use Directory Lister Pro?
I’ve never tried myself so don’t know all the features..
Or you could do this…
1.Get to the MS-DOS prompt or the Windows command line.
2.Navigate to the directory you want to print the contents of. If you’re new to the command line, familiarize yourself with the cd command and the dir command.
3.Once in the directory you want to print the contents of, type one of the below commands.
dir > print.txt
The above command takes the list of all the files and all of the information about the files, including size, modified date, etc., and send that output to the print.txt file in the current directory.
dir /b > print.txt
This command would print only the file names and not the file information of the files in the current directory.
dir /s /b > print.txt
This command would print only the file names of the files in the current directory and any other files in the directories in the current directory.
4.After doing any of the above steps the print.txt file is created. Open this file in any text editor (e.g. Notepad) and print the file. You can also do this from the command prompt by typing notepad print.txt.
Answer #4
Something kareem showed me some time back.
Copy the code below into notepad, then choose “save as” and use the name: “getDirList.bat” and save it to:
XP: C:\Documents and Settings\<username>\SendTo (Hidden folder)
Vista/Win7: C:\Users\<username>\AppData\Roaming\Microsoft\Windows\SendTo (Hidden system folder)

Automatic Directory Listing wrote: Select all

@echo ==================================================================
@echo ==================================================================
@echo Save this file as getDirList.bat in your SendTo directory.
@echo SendTo is under Documents and Settings in each user’s directory.
@echo Right-click on any directory in Windows Explorer and choose
@echo Send To – getDirList.bat
@echo ==================================================================
@echo ==================================================================
@echo Dumping directory listing to c:dirListing.txt
@REM the /A switch lists all hidden and system files as well.
@REM the /S switch lists all subdirectories and their contents.
@dir %1 /B > c:dirListing.txt
@echo Opening c:dirListing.txt in Notepad (Close notepad to delete file)
@notepad c:dirListing.txt
@echo Deleting c:dirListing.txt
@del c:dirListing.txt
@pause
(Now you can rightclick the folder where you got all the releases ->Send to -> getDirList.bat
And a notepad will pop upp with a list of all releases inside.)
Answer #5
I found this one a while back after searching everywhere for something that works well..
Called “Send To Toys” ….Sends what you highlight to the clipboard so you can paste it to notepad or whatever.
In alphabetical order too, if you wish..(Press Ctrl when clicking on ‘Send To Clipboard’, to set options)
http://www.gabrieleponti.com/software/
You only have to add the ‘Sent To’ features you want.
Answer #6
Good stuff guys..
There is also software that can do that for..Not only create the text file for you but give you the freedom to chose many combinations how the list should be done:
Directory Opus
Directory List And Print
Answer #7
Another good one is PrintFolder Pro.
Answer #8
Thanks for all the suggestions guys, really appreciate it!!!!
I’ve decided to go with Directory List & Print, its really easy to use and it’s portable