Win98banter

Win98banter (http://www.win98banter.com/index.php)
-   General (http://www.win98banter.com/forumdisplay.php?f=7)
-   -   Is there a way to turn a folder's filenames into a text file? (http://www.win98banter.com/showthread.php?t=52197)

J. P. Gilliver (John)[_2_] November 4th 17 03:30 PM

Is there a way to turn a folder's filenames into a text file?
 
In message ,
writes:
On Fri, 03 Nov 2017 23:05:00 -0600,
wrote:

On Fri, 03 Nov 2017 20:39:34 -0400, Nil
wrote:

On 03 Nov 2017,
wrote in
microsoft.public.windowsxp.general:

Aside from writing all of this on paper (too much work), is there
some software (freeware if possible) that can turn the filenames
in any folder into a text file, which I can save and have with me
at the WIFI.

I recall in the DOS days I could make such a filename list using
the "" after typing DIR. (I sort of forgot exactly how to do
that).

But that will only generate trunkated 8+3 filenames.

XP (and later)'s DOS emulation command line box will give you long file

[]
I'm using my Win98 computer right now. That does not work in Win98. I
get the 8+3 filenames. I will try it on my XP machine when I turn it on.

Nil did say "XP (and later)" (-:

It works on my w/98 machine.


That's interesting.

Were these stored with 8.3 file names for
some reason?


All files have an 8.3 filename (and can be accessed by it). Up to I
think '98 (probably Me too), you could see it in I think "Properties"
for the file, but for some reason best known to MS they removed that
from XP on; "dir /x" will show them, though.
--
J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf

The average US shareholding lasts 22 seconds. Nobody knows who invented the
fire hydrant: the patent records were destroyed in a fire. Sandcastles kill
more people than sharks. Your brain uses less power than the light in your
fridge. The Statue of Liberty wears size 879 shoes.
- John Lloyd, QI supremo (RT, 2014/9/27-10/3)

Bill in Co November 4th 17 08:46 PM

Is there a way to turn a folder's filenames into a text file?
 
J. P. Gilliver (John) wrote:
In message ,
writes:
On Fri, 03 Nov 2017 23:05:00 -0600,
wrote:

On Fri, 03 Nov 2017 20:39:34 -0400, Nil
wrote:

On 03 Nov 2017,
wrote in
microsoft.public.windowsxp.general:

Aside from writing all of this on paper (too much work), is there
some software (freeware if possible) that can turn the filenames
in any folder into a text file, which I can save and have with me
at the WIFI.

I recall in the DOS days I could make such a filename list using
the "" after typing DIR. (I sort of forgot exactly how to do
that).

But that will only generate trunkated 8+3 filenames.

XP (and later)'s DOS emulation command line box will give you long file

[]
I'm using my Win98 computer right now. That does not work in Win98. I
get the 8+3 filenames. I will try it on my XP machine when I turn it on.

Nil did say "XP (and later)" (-:

It works on my w/98 machine.


That's interesting.

Were these stored with 8.3 file names for
some reason?


All files have an 8.3 filename (and can be accessed by it). Up to I
think '98 (probably Me too), you could see it in I think "Properties"
for the file, but for some reason best known to MS they removed that
from XP on; "dir /x" will show them, though.


xplorer2 will still conveniently show them.



Lee November 5th 17 12:35 AM

Is there a way to turn a folder's filenames into a text file?
 
On Saturday, November 4, 2017 at 8:31:34 AM UTC-6, J. P. Gilliver (John) wrote:
In message ,
writes:
On Fri, 03 Nov 2017 23:05:00 -0600,
wrote:

On Fri, 03 Nov 2017 20:39:34 -0400, Nil
wrote:

On 03 Nov 2017,
wrote in
microsoft.public.windowsxp.general:

Aside from writing all of this on paper (too much work), is there
some software (freeware if possible) that can turn the filenames
in any folder into a text file, which I can save and have with me
at the WIFI.

I recall in the DOS days I could make such a filename list using
the "" after typing DIR. (I sort of forgot exactly how to do
that).

But that will only generate trunkated 8+3 filenames.

XP (and later)'s DOS emulation command line box will give you long file

[]
I'm using my Win98 computer right now. That does not work in Win98. I
get the 8+3 filenames. I will try it on my XP machine when I turn it on..


98 Windows DOSbox produces a directory listing with BOTH every time.
True DOS mode can't do long filenames unless you use special addon commands written to do expressly that. Collectively they are called LFN tools and bring long file names to true DOS mode - you don't get that with 9x MS-DOS as installed at all. Even in Windows DOSbox situation if you want to access a file by it's long filename you will have to use quotes around it or the DOSbox emulator will trigger on the first 'word' only.


Were these stored with 8.3 file names for
some reason?


Yes, for access in true DOS mode where long filenames can not be used without going to 3rd party solutions which MS NEVER offered. Using the 3rd party LFN tools will also require quotes around the long filename too.

A quite simple registry addition will make a text file from any folder's content quite easily. Copy and paste the text below into a blank notepad document with two blank lines following the outlined text below (do not include the lines) and save it as dir.reg. Then double click it and answer yes to merge with registry. Reboot, from now on your right click menu will include a DirPrint option and when you select it, the folder's directory listing will be written to C:\ADIR.TXT where you can open it and print it if so desired. That file will be overwritten without notice when the option is selected again so if it's content is valuable then you should move it somewhere safe PDQ.

----------------------

REGEDIT4

[HKEY_CLASSES_ROOT\Folder\shell\DirPrint]
@="&DirPrint"

[HKEY_CLASSES_ROOT\Folder\shell\DirPrint\command]
@="Command.com /C DIR %1 /a /o:gneC:\\ADIR.TXT"


----------------------
Since this approach uses 9x's DOS emulator as in a DOSbox situation, you will have BOTH the short 8.3 name and the long filename if it even exists.

There simply is no need for short filenames in NT, that command processor/emulator is long file name enabled from the start and doesn't even use the short form because it's not 8.3 limited DOS at all. It's an emulator from the start that is only made to look like DOS. Ironical enough NT batch is supremely powerful compared to 9x capabilities.

J. P. Gilliver (John)[_2_] November 5th 17 02:46 AM

Is there a way to turn a folder's filenames into a text file?
 
In message , Lee
writes:
[]
A quite simple registry addition will make a text file from any
folder's content quite easily. Copy and paste the text below into a
blank notepad document with two blank lines following the outlined text
below (do not include the lines) and save it as dir.reg. Then double
click it and answer yes to merge with registry. Reboot, from now on
your right click menu will include a DirPrint option and when you
select it, the folder's directory listing will be written to
C:\ADIR.TXT where you can open it and print it if so desired. That file
will be overwritten without notice when the option is selected again so
if it's content is valuable then you should move it somewhere safe PDQ.


Thanks for this.

----------------------

REGEDIT4

[HKEY_CLASSES_ROOT\Folder\shell\DirPrint]
@="&DirPrint"

[HKEY_CLASSES_ROOT\Folder\shell\DirPrint\command]
/C DIR %1 /a /o:gneC:\\ADIR.TXT"


----------------------
Since this approach uses 9x's DOS emulator as in a DOSbox situation,
you will have BOTH the short 8.3 name and the long filename if it even
exists.


If you leave out the "C:\\", will it create ADIR.TXT in the directory
whose files it lists?
[]
--
J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf

Religion is a name for opinion that cannot be argued about. [Heard on Radio 4,
2010-10-18, 9:xx.]

Lee November 5th 17 07:38 AM

Is there a way to turn a folder's filenames into a text file?
 
On Saturday, November 4, 2017 at 7:47:03 PM UTC-6, J. P. Gilliver (John) wrote:
In message , Lee
writes:
[]
A quite simple registry addition will make a text file from any
folder's content quite easily. Copy and paste the text below into a
blank notepad document with two blank lines following the outlined text
below (do not include the lines) and save it as dir.reg. Then double
click it and answer yes to merge with registry. Reboot, from now on
your right click menu will include a DirPrint option and when you
select it, the folder's directory listing will be written to
C:\ADIR.TXT where you can open it and print it if so desired. That file
will be overwritten without notice when the option is selected again so
if it's content is valuable then you should move it somewhere safe PDQ.


Thanks for this.

----------------------

REGEDIT4

[HKEY_CLASSES_ROOT\Folder\shell\DirPrint]
@="&DirPrint"

[HKEY_CLASSES_ROOT\Folder\shell\DirPrint\command]
/C DIR %1 /a /o:gneC:\\ADIR.TXT"


----------------------
Since this approach uses 9x's DOS emulator as in a DOSbox situation,
you will have BOTH the short 8.3 name and the long filename if it even
exists.


If you leave out the "C:\\", will it create ADIR.TXT in the directory
whose files it lists?
[]
--
J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf

Religion is a name for opinion that cannot be argued about. [Heard on Radio 4,
2010-10-18, 9:xx.]


You are certainly welcome and glad to actually help. It's probably going to drop the file in the Windows folder instead since that's where command.com lives. One could have it the way you ask about by using the %1 passed parameter which represents/expands to the complete folder pathname in question. So %1\\ADIR.TXT may be just the ticket for that behavior asked about. It will overwrite any file of that particular name in that folder, but what are the odds?


R.Wieser November 5th 17 08:19 AM

Is there a way to turn a folder's filenames into a text file?
 
John,

If you leave out the "C:\\", will it create ADIR.TXT in the directory
whose files it lists?


If it doesn't, try this:

/C DIR %1 /a /o:gne%1\..\ADIR.TXT"


(thats a slash, two dots and a slash)

Regards,
Rudy Wieser



Lee November 5th 17 01:43 PM

Is there a way to turn a folder's filenames into a text file?
 
On Sunday, November 5, 2017 at 1:19:34 AM UTC-6, R.Wieser wrote:
John,

If you leave out the "C:\\", will it create ADIR.TXT in the directory
whose files it lists?


If it doesn't, try this:

/C DIR %1 /a /o:gne%1\..\ADIR.TXT"


(thats a slash, two dots and a slash)

Regards,
Rudy Wieser


May need:
@="Command.com /C DIR %1 /a /o:gne%1\\..\\ADIR.TXT"

since this is a registry file and two backslashes are needed to equate down to a single backslash for DOS operations - I think.

Looking at the actual value in regedit would show your text as given but the merging of a .reg file causes two backslashes to equal one. I dunno why, just something I've noticed. Sort of like in a batch file when you want %1 done there you need to actually write %%1 when it's done from a batch file only. Again dunno why exactly.

Not remembering all the shortcut scripts but wouldn't that equate to the root drive of the target folder? Something like that is bubbling in the back of my mind anyway.

R.Wieser November 5th 17 02:36 PM

Is there a way to turn a folder's filenames into a text file?
 
Lee,

May need: [snip]


You're right. I forgot that was ment for a .REG file. :-\ :-)

would show your text as given but the merging of a .reg file causes
two backslashes to equal one. I dunno why, just something I've noticed


The backslash is used as an so-called "escape" character. It is used to
mark certain characters (stored in a .REG file) as being used as literals.
Like an embedded double-quote (like in [program.exe "%1"]) being preceeded
by an escape-character, to indicate it should not be regarded as a special
character (end of a string here).

Example: "program.exe \"%1\""

Not remembering all the shortcut scripts but wouldn't that equate
to the root drive of the target folder?


Nope. :-)

The dot-dot is used with the DOS CD command to go one directory up, or when
provided in a path string, to remove the path-element just before it.
Regardless of, and that is the "trick", if that path-element points to a
folder or a file.

In other words:
"drive:\folder\filename\.."

will resolve to

"drive:\folder"

Oh blimey! I just realized that I'm trying to remove a file specification
where there most likely is none ... What I suggested would place the output
file in the parent of the folder which files are listed. :-(

... and I realized something else: the %1 could well contain embedded spaces,
so it must be enclosed in double-quotes (for *both* usages of %1):

@="Command.com /C DIR \"%1\" /a /o:gne \"%1\\ADIR.TXT\""

Regards,
Rudy Wieser



Lee November 6th 17 02:00 AM

Is there a way to turn a folder's filenames into a text file?
 
Rudy,
On the same page now and that's the important part, thanks for the return message. I knew I had seen that before though and it was probably from within batch work coming from another batch which means %1 then and there resolves to the full filename and pathname of calling batch file itself and if you want to drop a result file in that folder you need to 'back up one' from that actual calling batch file and/or executable. And it makes good sense only now.

Windows DOSbox may be able to handle the expansion of %1 with spaces within but only actual testing would show and your quoting should otherwise provide protection from any space in such a pathname. I only gave it a couple shots and that does not qualify as 'testing' by any means. Unfortunately I wouldn't know what a literal was if it came up and bit me in the hindquarters - not your problem to explain either, I've tried many times before and no joy. I'm sure there many good sites to go look that up too, I'm just not in a mood to do that at the moment. For now I've made a mental note and it seems to be gelling somewhat - thanks.

R.Wieser November 6th 17 08:55 AM

Is there a way to turn a folder's filenames into a text file?
 
Lee,

I knew I had seen that before though and it was probably from within
batch work coming from another batch


:-) I'm using it in the same way, for the same reason.

%1 then and there resolves to the full filename and pathname of calling
batch
file itself


I think you ment %0 there ...

I only gave it a couple shots and that does not qualify as 'testing' by
any
means


Another thing you can do: Open the registry and search for "%1" (without the
doublequotes -- or, now It think of it, with). You will find entries which
show them enclosed like that.

.... But not always. It depends on the program and how it looks at its
arguments: If it only expects a pathname it will not even try to parse
anything, but will regard the whole argument string (including spaces and
other whitespace stuff) as a single argument. Other programs will accept
leading switches (mostly preceeded by a forward slash), but the moment it
doesn't find such a switch it regards the rest (upto the line end) as the
last, single argument.

But as rule-of-thumb, enclose path/filenames in doublequotes so you're not
caught with your pants down when either contains a space character. :-)

Unfortunately I wouldn't know what a literal was if it came up and bit me
in the hindquarters - not your problem to explain either


Same with me actually, I just knew about that backslash being an escape
character, and how to use it to embed doublequotes in a string.

What I normally do is to enter everything into the registry without
bothering about literals, and just let the registries export mechanism do
its work (and have it escape everything it thinks is neccesary).

Hey, I'm a hobby prorammer, I'm *expected* to be lazy like that. :-)

Regards,
Rudy Wieser




All times are GMT +1. The time now is 02:54 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Win98Banter.com