Printing file names in a folder to a file

Q & A for the old 2X Explorer file manager. For other topics, please use the corresponding forum.

Moderators: fgagnon, nikos, Site Mods

jmw
New Member
Posts: 8
Joined: 2003 Dec 10, 16:10

Printing file names in a folder to a file

Post by jmw »

Is there any way to print all of the file names (only the file names) in a folder to the 2X editor.

I can print all of the file names to the 2X editor but it has all of the files information and I just want the names. Is there any way to do this.
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

I think you mean by 'all of the files information' the full path of the file? This is what you get by using Copy names (Alt+C) when all files are selected. Am I right??

A way to get what you want is this:

make sure the pane the files are in is set to list mode (pane style, accessible through the context menu or the menu View|Pane style> ). Thsu you have only one column showing the names of the files. select all files (Ctrl+A) and copy the column through Ctrl+P or the menu Edit|Copy columns.

Switch to Editor2 and paste and admire the result ;)
Dumb questions are the ones that are never asked :turn:
jmw
New Member
Posts: 8
Joined: 2003 Dec 10, 16:10

Still not doing what I want

Post by jmw »

When I cut and paste the files from the directory (folder) to the editor it also whoes the zise and the date modified. I don't want this, I just need the files names only.

BTW, is there any other way to pull up the editor other than using MARK - Print Selection. That is what I do now and it puts the files I've highlighted into the editor automatically.

Thanks
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

Sorry jmw,

I'm still not used to the separate forums for 2xExplorer and Xplorer2 :roll:

The modus operandi I described applies to X2 only. I'm sorry. Don't know how to do what you want from 2X directly.

I do know a more elaborate way. Maybe it suits your needs for now...

With the pane you want the listing for as active pane, go to the address bar and type:

Code: Select all

$ dir /b filemask
where 'filemask' is optional (e.g. *.txt gives you only folder and file matching .txt at the end of the name) and you can specify any valid DOS filter for files. You can furthermore specify any option the dir command supports of course.
The '/b' in the command ensures that the resulting command prompt shows only file and directory names (I imagine the b stands for 'bare format').
You can then copy these and paste them into whatever you want (for instance Editor2).

I know its cumbersome and maybe there's someone out there who knows a (much!) simpler way?? But it does the trick using 2X :wink: [/code]
Dumb questions are the ones that are never asked :turn:
User avatar
mimeryme
Bronze Member
Bronze Member
Posts: 107
Joined: 2003 Apr 29, 18:38
Location: Brooklyn
Contact:

Post by mimeryme »

That last method is the best way to do it anyhow IMO. If you want it to be in a new text file, just add "> filename."

dir /b filemask > filename

So, to get a list of textfiles of a given directory in a text file you'd type: dir /b *.txt > list.txt
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

mimeryme wrote:So, to get a list of textfiles of a given directory in a text file you'd type: dir /b *.txt > list.txt
Don't forget the '$' in front of the statement if you are using the 2X address bar though!! 8)
Dumb questions are the ones that are never asked :turn:
jmw
New Member
Posts: 8
Joined: 2003 Dec 10, 16:10

Post by jmw »

I finally was able to get the list I wanted using part of your suggestions.

When I used the command line $ dir *.* /b > list.txt I was thrown into a DOS window and I was in the directory I wanted to be in. So I typed in
dir *.* /b > list.txt and all of my files names were listed in list.txt which is what I wanted.

Why I was thrown into the DOS window I don't knw but I did get everything worked out.

Thanks for the help.
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

jmw wrote:When I used the command line $ dir *.* /b > list.txt I was thrown into a DOS window and I was in the directory I wanted to be in. So I typed in
dir *.* /b > list.txt and all of my files names were listed in list.txt which is what I wanted
The $-sign in the address bar of 2X is specifically designed to create a DOS box, so it's no surprise it appears.

You already got what you wanted in list.txt when the dos window opened the first time (you didn't check for the existence of the file I guess). Executing the second command in the dos box simple created the same file again (with the same contents).

Glad to know your problem is solved.
Dumb questions are the ones that are never asked :turn:
jmw
New Member
Posts: 8
Joined: 2003 Dec 10, 16:10

Post by jmw »

I did get a list.txt created but it was empty. So when I did "dir *.* /b > list.txt" on the command line in the DOS window, then I got data in list.txt
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

Now I'm puzzled :shock:

I know you have reached your goal so you probably couldn't care less why it didn't seem to work the first time, but now I'd like to know what's going on :roll:

You really should have had the list in the file 'list.txt' immediately after executing the command from the address bar! You wouldn't see anything displayed in the dos box (save the prompt), but the file should be created AND contain the list of files present in the directory you were in when issuing the command. Odds are it even contains the list.txt file name itself!
Dumb questions are the ones that are never asked :turn:
jmw
New Member
Posts: 8
Joined: 2003 Dec 10, 16:10

Post by jmw »

Maybe I should show you what I had in the address bar. This is it

$ C:\Program Files\Common Files\Art Plus Uninstall\*.* /b > list.txt

This command line did exactly what you said, it opened the DOS window and put the cursor right at the end of the directory name. It also created the file "list.txt" in that directory but it had nothing in it.

Perhaps I've misunderstood what the syntax should have been.

This
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

Aha, now we're getting somewhere!!

The command line you use

Code: Select all

$ C:\Program Files\Common Files\Art Plus Uninstall\*.* /b > list.txt
will probably open the dos box and complain about the command. You don't specify a DOS command, but simply state a folder name. The redirection (through the '>' symbol) still takes place, but the output of the 'command' is empty, so the file list.txt will also be empty.

You should have literally used the command I specified. The 'dir' didn't mean : "type the directory name", but 'dir' is the dos command to get a directory listing (as you probably know). 2X already takes care of putting you in the right directory. In fact, if you only specify '$' on the address bar, it opens a dos box for you in the folder you have opened in the active pane. Thats what makes it so useful.

Try

Code: Select all

$ dir *.* /b > list.txt
(exactly as shown here!) and you'll get the result you want in one go!

Let me know if it works. Then I can put my mind at ease :wink:
Dumb questions are the ones that are never asked :turn:
jmw
New Member
Posts: 8
Joined: 2003 Dec 10, 16:10

Post by jmw »

That did the trick.

I thought the "dir" you kept referring to was just short hand for the drive and path I was using. Even though I used the "dir" command in the DOS window to create the good "list.txt" file I still did not think it was used in the address window of 2X.

Thanks for having the patience to stick with me until this was finally sorted out.
User avatar
JRz
Gold Member
Gold Member
Posts: 560
Joined: 2003 Jun 10, 23:19
Location: NL

Post by JRz »

No worries. Now both our minds are set at ease ;)

Now you understand the power of the address bar, I think. You can use any dos command (internal or external) in the address bar, where 2X ensures the current working directory is set to the folder you have opened in the active pane. Unfortunately doesn't work for UNC paths though (paths beginning with \\machinename\sharename...)
Dumb questions are the ones that are never asked :turn:
User avatar
zippit
Silver Member
Silver Member
Posts: 240
Joined: 2003 Mar 11, 23:40
Location: Mississauga,ON,Canada

Post by zippit »

JRz wrote:I think you mean by 'all of the files information' the full path of the file? This is what you get by using Copy names (Alt+C) when all files are selected. Am I right??

A way to get what you want is this:

make sure the pane the files are in is set to list mode (pane style, accessible through the context menu or the menu View|Pane style> ). Thsu you have only one column showing the names of the files. select all files (Ctrl+A) and copy the column through Ctrl+P or the menu Edit|Copy columns.

Switch to Editor2 and paste and admire the result ;)
Quote:
(only the file names)
I don't think this is a 2x or x2 operation,but a seperate utility.
:roll:
War is Hell
Lest We Forget.
Post Reply