Send Directory, Subdir Contents to File w/Path

English support forum

Moderators: white, Hacker, petermad, Stefan2

Alonzo Mosley
Junior Member
Junior Member
Posts: 61
Joined: 2018-03-28, 20:13 UTC

Send Directory, Subdir Contents to File w/Path

Post by *Alonzo Mosley »

I need to do an MRT on a few hundred files, and it dawned on me that it would be good to have a table that shows old filename <=> new filename.

So I thought I would create a spreadsheet that listed Old Filepath+Filename and File info (e.g., size, date), and then do the same with the new and marry 'em up.

I know that at the CMD prompt

Code: Select all

dir /s > OldFiles.TXT
Will give me a nice list of all the files and their info, by subdirectory.

But it doesn't give me one line per path\name.

That is, it shows:
Directory of B:\Master\Subdirectory 1
11/19/2022 22:04 <DIR> .
11/19/2022 22:04 <DIR> ..
03/10/2014 18:14 43,309,056 00000.MTM
03/10/2014 18:16 54,355,968 00001.MTM
03/10/2014 18:17 46,884,864 00002.MTM
and so on, when I would like it to show
03/10/2014 18:14 43,309,056 B:\Master\Subdirectory 1\00000.MTM
03/10/2014 18:16 54,355,968 B:\Master\Subdirectory 1\00001.MTM
03/10/2014 18:17 46,884,864 B:\Master\Subdirectory 1\00002.MTM
I would have thought if I did Search, *.* and Fed to Listbox, there'd be a way to export a full listing. But I can't seem to figure it out.

Any ideas?

Thanks in advance!
Dan: You're gonna need to get someone to fix my computer.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
User avatar
Dalai
Power Member
Power Member
Posts: 9388
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Send Directory, Subdir Contents to File w/Path

Post by *Dalai »

Code: Select all

dir /s /b <some_path>
creates a list of full paths. This file can also be sorted via the /o switch, e.g.

Code: Select all

dir /s /b /ogn
to have directories first and files sorted by name. If you don't need directories listed, you can exclude them by adding the /a-d switch.

With TC this can also be achieved, of course. After feeding to listbox, select all files (e.g. by pressing Ctrl+A) and then use menu Mark > Save Selection to File. Note that this saves the file in UTF-16 encoding, while CMD's dir command creates an ASCII file.

I recommend to use the MRT's "Load names from file" feature if this is feasible.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Alonzo Mosley
Junior Member
Junior Member
Posts: 61
Joined: 2018-03-28, 20:13 UTC

Re: Send Directory, Subdir Contents to File w/Path

Post by *Alonzo Mosley »

Cool! Thanks! For some reason I thought I remembered that the CMD /b switch gave me filenames only. Will check it out.

The TC Mark Files, from what I can tell, only saves the filepath, not the data (e.g., size, date).

What's "Load Names from File" feature? I poked around and didn't see it....
Dan: You're gonna need to get someone to fix my computer.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
User avatar
Dalai
Power Member
Power Member
Posts: 9388
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Send Directory, Subdir Contents to File w/Path

Post by *Dalai »

Alonzo Mosley wrote: 2022-11-21, 02:16 UTCFor some reason I thought I remembered that the CMD /b switch gave me filenames only.
This is true if the /s switch is not given.
The TC Mark Files, from what I can tell, only saves the filepath, not the data (e.g., size, date).
Do you really need additional information like size and date? I'm asking because the dir /s /b command given above doesn't output them either. In TC, this can be shown when you make a custom columns view containing the information you want and switch to that custom columns view after feeding the search results to the listbox. To copy the information shown, you can use Mark > Copy to Clipboard with Path+Details.
What's "Load Names from File" feature? I poked around and didn't see it....
It's in the MRT behind the button with the folder symbol on it (below the one with the question mark). See TC help for more information on what that button and menu item does. Note that this list must only contain file names, one per line. That's another reason why I asked if you need more than just the file names.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
petermad
Power Member
Power Member
Posts: 14796
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Send Directory, Subdir Contents to File w/Path

Post by *petermad »

TC offers several command to copy filenames:

To file:
cm_SaveSelectionToFile=2031;Save file selection to file
cm_SaveSelectionToFileA=2041;Save file selection to file (ANSI)
cm_SaveSelectionToFileW=2042;Save file selection to file (Unicode)
cm_SaveDetailsToFile=2039;Save all shown columns to file
cm_SaveDetailsToFileA=2043;Save all shown columns to file (ANSI)
cm_SaveDetailsToFileW=2044;Save all shown columns to file (Unicode)
cm_SaveHdrDetailsToFile=2093;Save all shown columns to file, with headers
cm_SaveHdrDetailsToFileA=2094;Save all shown columns to file, with headers (ANSI)
cm_SaveHdrDetailsToFileW=2095;Save all shown columns to file, with headers (Unicode)

To Clipbord:
cm_CopyFileDetailsToClip=2036;Copy all shown columns
cm_CopyFpFileDetailsToClip=2037;Copy all columns, with full path
cm_CopyNetFileDetailsToClip=2038;Copy all columns, with UNC path
cm_CopyHdrFileDetailsToClip=2090;Copy all shown columns, with headers
cm_CopyHdrFpFileDetailsToClip=2091;Copy all columns, with headers+full path
cm_CopyHdrNetFileDetailsToClip=2092;Copy all columns, with headers+UNC path
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Alonzo Mosley
Junior Member
Junior Member
Posts: 61
Joined: 2018-03-28, 20:13 UTC

Re: Send Directory, Subdir Contents to File w/Path

Post by *Alonzo Mosley »

Thanks, Dalai. I *NEVER* would have found that "folder" button! I don't know that that will help me, though. But will experiment tonight.

As for "why" I want the file information with the file path, two reasons:
  1. The Snarky One. Because it's what I asked for.
  2. The Legit One. Like I said in the OP, I need to rename a bunch of files. At some point i may need to know what the original filename was. The only way I can think of to track it back is to build a table. And the only unique identifier I can come up with is a by-date, by-size sort. The odds of two files being the exact same size and being created at the exact same time are pretty slim - and even so, it would still narrow down the hunt if I did have to find the original.
@petermad:
That looks like a list that will do me some good. Not sure what I'm supposed to do with the "command" /

Code: Select all

cm_Save....
information. Is there a command line editor in TC that I should know about?

I really only use TC to do MRN on my expense accounts every week, so I am woefully undereducated in all of this other stuff.
Dan: You're gonna need to get someone to fix my computer.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
User avatar
Dalai
Power Member
Power Member
Posts: 9388
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Send Directory, Subdir Contents to File w/Path

Post by *Dalai »

Do you intend to rename "a few hundred" files by hand? Or do you want to use some search&replace operation(s)? Although the first post doesn't let me assume the former, TC's MRT also allows to do it this way via the "Edit names..." menu item behind the same button mentioned above. This loads the list of names shown in the MRT into an editor (which is configurable via the same button). The list file contains the current file names, one per line. This way you could rename the files one by one, based on the current names (but without any additional information like size and date).

Even if you don't want to rename the files by hand, you could use the search&replace operation(s) first and fine tune the names in the editor afterwards.

The choice is yours. If you need additional information feel free to ask. In the end TC should (and often can) make life easier, so it's a good idea to know what it can do to reduce the amount of work.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Alonzo Mosley
Junior Member
Junior Member
Posts: 61
Joined: 2018-03-28, 20:13 UTC

Re: Send Directory, Subdir Contents to File w/Path

Post by *Alonzo Mosley »

Not by hand, but with a convention based on their NEW directories. I'm taking thousands of raw files, saving a few hundred in new locations, and hoping to be done. But you know some jackass in six months will want to know why we saved file NewLoc-0024 when there was a version that he just knows was better... So I'll need to dig out the original and show him he's wrong.
Dan: You're gonna need to get someone to fix my computer.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
User avatar
solid
Power Member
Power Member
Posts: 747
Joined: 2004-08-09, 11:20 UTC

Re: Send Directory, Subdir Contents to File w/Path

Post by *solid »

Maybe if you describe your working scenario, what exactly you need to perform on the files, users will offer more elegant solution to your problem.
Alonzo Mosley
Junior Member
Junior Member
Posts: 61
Joined: 2018-03-28, 20:13 UTC

Re: Send Directory, Subdir Contents to File w/Path

Post by *Alonzo Mosley »

I believe I have described exactly what I'm doing:
I want a list (e.g., CSV, Tab Delimited) of files that are in subdirectories, with filepaths, their creation date, and their size.
Dan: You're gonna need to get someone to fix my computer.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
User avatar
solid
Power Member
Power Member
Posts: 747
Joined: 2004-08-09, 11:20 UTC

Re: Send Directory, Subdir Contents to File w/Path

Post by *solid »

I thought about the goal you want to achieve with this step, nevermind.

Check Catalog maker plugin (https://totalcmd.net/plugring/catalogmaker.html)
Alonzo Mosley
Junior Member
Junior Member
Posts: 61
Joined: 2018-03-28, 20:13 UTC

Re: Send Directory, Subdir Contents to File w/Path

Post by *Alonzo Mosley »

Thanks. I'm having a little trouble with that. I downloaded and unzipped the file.

I'm following the directions for "How to install and use a packer plugin" but am stuck on:
5. Type an extension suitable for the plugin, e.g. "lst" for diskdir
What extension do I type in? Don't I want this to be able to run for all extensions?

Thanks in advance,
Dan: You're gonna need to get someone to fix my computer.
Kim: What's wrong with it?
Dan: It's in several pieces on my floor.
User avatar
Dalai
Power Member
Power Member
Posts: 9388
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Send Directory, Subdir Contents to File w/Path

Post by *Dalai »

2Alonzo Mosley
Don't unzip anything. Just press Enter (or double-click) on the downloaded archive in TC and it will guide you through the plugin installation, including the registration of an extension for "packing".

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3862
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Re: Send Directory, Subdir Contents to File w/Path

Post by *sqa_wizard »

The extension you enter will be the default extension of the resulting list, created by diskdir.
#5767 Personal license
User avatar
petermad
Power Member
Power Member
Posts: 14796
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Send Directory, Subdir Contents to File w/Path

Post by *petermad »

2Alonzo Mosley
@petermad:
That looks like a list that will do me some good. Not sure what I'm supposed to do with the "command" /

Code: Select all

cm_Save....

information. Is there a command line editor in TC that I should know about?
There is the "Choose Command" dialog that you can open from TC's command line by entering cm_CommandBrowser.

I want a list (e.g., CSV, Tab Delimited) of files that are in subdirectories, with filepaths, their creation date, and their size.
Well for that either do a Search (Alt+F7) and Feed it to Listbox OR enable Branch View (Ctrl+B).
Then mark all files and use the Menu -> "Mark" -> "Copy To Clipboard With Path+Details". (that is the same as using command cm_CopyFpFileDetailsToClip)
Make a new text file (Shift+F4) and paste the content of the clipboard.

If you want a special selection of info in a special order, you can do so with Custom Colums (but you will always get Name/Ext in the start of each line)
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply