Windows -- I just want the damn filenames

Recurrent Mac user issue with Windows — the kind of issue that probably stems from knowing MacOS quite well and hence how to do things, while being stone ignorant of how one does equivalent things in Windows, you know?

On the Mac, if you want all the filenames in Folder X, as text, for whatever purposes (I can think of several dozen, your mileage may vary), all you gotta do is select them all, copy, go to where you want 'em, and paste. I could paste you all the filenames of a specified folder right here, for example.

Go to Windows now. Nope, Control-C won’t copy filenames. Will copy files just fine, but you can’t select two dozen files and copy their filenames that way. So, Google around and learn how it’s done, right? And the conventional wisdom is open up a command prompt, navigate to the folder in question, and type “dir > filelisting.txt” and hit enter and it generates a text file named “filelisting” and inside it is what you want. Allrighty, kinda klunky but as long as it works…

Well it kind of doesn’t. Here’s what you find when you open filelisting.txt:

If I’m trying to create a stack of filenames, with no other info, I’ve got to get rid of a lot of extraneous stuff to use this.

So I have to write a routine that ignores the first 7 lines and then on all subsequent lines parses out from character 51 to the next space and keeps that and only that from each subsequent line.

Is there a Secret Windows User Trick that y’all use in situations like this?

Okay, sort of. With steps.

Highlight the files you want and shift+right-click. You’ll see a new option called “copy as path.” Paste where you like.

It still has extraneous stuff, but just the full directory paths. Easy enough to pop them into your program of choice and do a “replace all” with null values.

DIR /B /A-D > filelisting.txt

In the command window, use “dir /b”. That strips out all the extra fluff you don’t need.

ETA: ninja’ed by ECG with a slightly better solution that removes folder names.

Damn, that’s way better than mine. I withdraw my tip.

nm attempt at humor

Yayy! I knew there had to be a way!

You can also do:
dir /B /A-D | clip

That will put the output directly into the clipboard for pasting somewhere.

Ooooh, even better! Yeah, littering up the place with files just so I can open them select all and copy is far inferior to putting the output onto the clipboard directly.

| clip works for all sorts of other stuff, too. For instance, if you already have a text file containing some stuff, you can enter type myfile.txt | clip to move it there. Or echo Hello, world! | clip to put random text there.

The OP “just wants the filenames”, I just want to see the files.

Vintage Mac/Windows user here, and got spoiled by early Macs/PCs. It was so easy to find a file, then do crap to it.

Which is why I find iOS so frustrating. Okay, I want to move an mp3 file from my Mac onto an iPhone or an iPad… I’m used to the very intuitive “Open two windows, one on the Mac, one on the iPhone, and drag that audio file over.”

Well, okay, Apple, I’ll play your little game of sync’ing with iTunes or iCloud to add my music to my phone…
But then, where IS it? I want to open a file folder and see a list of music files, and sort them by size or bitrate if I feel like it. I can do that on my Mac, why can’t I do it on the other devices made by the same company?

(Yeah, this is a tangent. Feel free to ignore.)

Users find hierarchical file systems too confusing. Apple and Google solved the problem by hiding the filesystem and making it more difficult to transfer files, so that users are less likely to get into trouble. Just buy the song on iTunes and think happy thoughts.

For better or worse, iOS was designed for people who don’t want to know about file structures.

FYI, you can usually get the list of options for Windows command line utilities by putting /? as the option.

So for example, dir /? gives you the syntax and options for the ‘dir’ command, including the /b option

" /B Uses bare format (no heading information or summary)."

There’s a reason I’m a cell phone luddite.

If a hierarchical file system is too confusing, imagine having to cope with an actual file cabinet!

My file cabinet looks very similar to my computer files. Disorganised.

Ha! I used to drum File Organization into my computer students. Had them set up basically a digital file cabinet with dozens of folders and sub-folders.

I used to spend hours organizing files, making new folders, color-coding them… You know what really changed that? Having a “Find” or “Search” command that really works, and does it quickly.

Now, if a client calls with, say, a change to last year’s brochure, I just search for ZebraTech Final Brochure 2020, and open it up. Make the change, total time 2 minutes.

Probably less time than finding and opening my FREELANCE folder, then scrolling down the list of clients and opening the last one, ZEBRATECH. Then MARKETING PROJECTS, then BROCHURES, sort that by date so the latest versions show up at the top of the list, then finally “ZebraTech Final Brochure 2020”.

So now I just drop files in Work, Freelance, Fun!, and Misc. file folders, and just use a shortcut for “Find” when I need 'em. Saving time and stress!

The Music app is effectively that folder. Granted, the ordering options are limited, but the songs are right there in a list for you.

I agree. I’ve been using a great little search utility for years that’s better than anything built into Windows. It’s called Everything, because it finds everything.

Freeware, small, ultra-fast, pops up with a hotkey, has many options. Just type part of the file name (and/or extension, wildcards, etc.) and the list of files it displays updates instantly in real time as you type. It takes seconds to find any file on your machine.

I also use XYplorer as a file manager, rather than the default File Explorer. It’s by far the best file manager I’ve ever used.

In XYplorer, if you want to copy the file names or the names with paths to the clipboard, you select the file(s), and press ctrl-p or ctrl-shift-p.