New
#1
How to make list of files in a folder?
Can someone please tell me How to make list of files in a folder using cmd? Thanks.
Can someone please tell me How to make list of files in a folder using cmd? Thanks.
dir f:\Music /b /s > c:\textfile.txt
The above command will make a list of all files in the Music folder of the F drive, including subdirectories. The list will be found in the root of the C drive under the name "textfile.txt".
Adapt it to your needs.
There is a tiny (just 124 KB) utillity named LS File List Generator. Easier than cmd and no need to install of course. I use it from the Win 2000 era. Check the Attachment.
Then, borrowing (swiping ) from all above, the final version would be:
dir f:\Music /b /s > "%UserProfile%\Desktop\filelist.txt"
(My choice of "filelist")
And with Powershell cmd prompt:
Get-ChildItem C:\Temp -Name | tee-object c:\temp\names.txt
Just another way to do what you want...
Actually that would be: Get-ChildItem -Path F:\Music -r | tee-object $env:userprofile\desktop\filelist.txt
If the user Desktop folder might have been relocated then the PS would need to be
- Put the folder of interest in place of 'F:\Music or whatever' and ensure you keep the quotation marks if the path has any spaces in it.Code:$path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" $UserDesktop = (Get-ItemProperty -Path $path -Name "Desktop").Desktop Get-ChildItem -Path "F:\Music or whatever" -r | tee-object "$UserDesktop\FileList.txt"
- Put whatever file name.extension you want in place of 'FileList.txt 'and ensure you keep the quotation marks if the filename, the Desktop path or the UserName have [or might have] any spaces in them.
Denis