Text list of selected file names

J

J.W.Boudreau

Desired scenario:
I am in a directory with a bunch of mp3's, I select a set of them,
apply the script, and a simple text file (m3u) is generated in the
same directory that contains the names of the selected files.

I will add the feature to the explorer context
menu for type .mp3 files.



~Jared
(I have xp pro)
 
H

Herb Martin

Desired scenario:
I am in a directory with a bunch of mp3's, I select a set of them,
apply the script, and a simple text file (m3u) is generated in the
same directory that contains the names of the selected files.

I will add the feature to the explorer context
menu for type .mp3 files.

Why bother? Just drop to a command prompt,

dir *.mp3 /b >files.m3u

/b means "bare", i.e., without the file property details.

You can add /od or /on to ensure sort order by date or
name.
 
J

J.W.Boudreau

dir *.mp3 /b >files.m3u

Trouble is, that will make a huge list with thousands of lines.

I am looking to list the selected subset.

(The script needs to know what is selected)

~Jared
 
A

Al Dunbar

Trouble is, that will make a huge list with thousands of lines.

I am looking to list the selected subset.

(The script needs to know what is selected)

drag your selected list onto a shortcut to a script containing:

@echo off
:nextshift
if "%~1" NEQ "" goto:next
notepad "%~dp1\files.m3u"

This will fail if the number of files or the lengths of the pathnames is
excessive, but you could run it on sets and the results would be appended.
The files.m3u file would be in the same folder as the mp3's, and would
contain the full path names. You could change this using the following
variations:

Something similar could be done using vbscript, unfortunately, a command
line length limitation will still apply (perhaps a slightly larger one).

Setting such a script to run from an explorer context menu would remove the
need to keep a shortcut handy - it would be interesting to see if that would
allow for a larger selection.

/Al
 
H

Herb Martin

Trouble is, that will make a huge list with thousands of lines.

I am looking to list the selected subset.

Sorry, I missed the "selected part" but just go into the text file,
add a marker to (the front) of each desired (or undesired) line
and run FindStr or a better grep tool to keep or remove whichever
you prefer.
 
J

J.W.Boudreau

drag your selected list onto a shortcut to a script containing:
@echo off
:next
shift
if "%~1" NEQ "" goto:next
notepad "%~dp1\files.m3u"
Setting such a script to run from an explorer context menu would remove the
need to keep a shortcut handy - it would be interesting to see if that would
allow for a larger selection.

/Al


This works very well for dragged and dropped, had to change the
notepad command to echo.
So as a file type context item, it attempts to run the script once
for each mp3, which is ok without notepad in there.
still would take a little bit for a very large list, but mine are
usually under 50.
 
A

Al Dunbar

This works very well for dragged and dropped, had to change the
notepad command to echo.
So as a file type context item, it attempts to run the script once
for each mp3, which is ok without notepad in there.
still would take a little bit for a very large list, but mine are
usually under 50.

Interesting that it runs each file separately, but when you think about it,
it makes sense. This would probably mean that the limitations I mentioned
would not be an issue here.

The notepad command only makes sense in the drag-n-drop environment. One
thing I am curious about is whether the scripts ran concurrently or
serially. If they ran concurrently, there might be some contention for the
output file. In either case, it must have been odd seeing fifty command
prompt windows popping up. That might be one good reason to recode in
vbscript.

/Al
 
J

J.W.Boudreau

Interesting that it runs each file separately, but when you think about it,
it makes sense. This would probably mean that the limitations I mentioned
would not be an issue here.

Thats true, it only needs to process one file at a time.
The notepad command only makes sense in the drag-n-drop environment. One
thing I am curious about is whether the scripts ran concurrently or
serially. If they ran concurrently, there might be some contention for the
output file. In either case, it must have been odd seeing fifty command
prompt windows popping up. That might be one good reason to recode in
vbscript.

/Al

It looks to run serially as it will list the files in order from
explorer. (same order as if you were coping or moving the selected
files)
I made a list of 90 and it only takes 20 seconds or so, as each item
needs to run the script, perhaps if I had a multiple core cpu, there
would be file contention. as of now it delivers just what the Dr.
ordered.

@echo off
:nextshift
if "%~1" NEQ "" goto:next
echo "%~dp1\files.m3u"


~Jared
 
A

Al Dunbar

Thats true, it only needs to process one file at a time.


It looks to run serially as it will list the files in order from
explorer. (same order as if you were coping or moving the selected
files)
I made a list of 90 and it only takes 20 seconds or so, as each item
needs to run the script, perhaps if I had a multiple core cpu, there
would be file contention. as of now it delivers just what the Dr.
ordered.

@echo off
:next
shift
if "%~1" NEQ "" goto:next
echo "%~dp1\files.m3u"

Glad to hear of another happy customer! Note that the echo line probably has
no value, as the window will likely close before you have had a chance to
read the output. Doesn't hurt anything to keep it there other than using up
a small amount of time.

Do you find the multiple command prompt windows annoying? I know I would. If
so, I'd suggest you look at re-coding in vbscript. that might even be a
teeny bit faster, as it wouldn't open up any windows. Of course, you would
not really know that it succeeded or was finished until you opened the
file...

/Al



/Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top