Sign in to follow this  
Followers 0
zarkok

create list of filenames only

4 posts in this topic

Hi, I have a problem with my code. I read some forums and posts and I used part of the code found but I don't know to fix a problem.

Here is my code:

$folder = $CMDLine[1]
$wildcards = "*.cue"
Runwait(@comspec &' /c dir "'& $FOLDER & '\' & $WILDCARDS &'" /b/s >'& @TempDir &'\list.tmp',"",@SW_HIDE)

$lines=StringSplit(Stringreplace(fileread(@TempDir & "\list.tmp",FileGetSize (@TempDir &"\list.tmp")),@lf,""),@CR)

HOW TO FIX THAT?--->>>>>>> $name=StringSplit(Stringreplace(fileread(@TempDir & "\list.tmp",FileGetSize (@TempDir &"\list.tmp")),@lf,""),@CR) <<<<<<----

for $i=1 to $lines[0]-1
IniWrite("C:\Program Files\NeoBook 5\" & $CMDLine[2] & ".Ini", $name[$i] , "Ruta", $lines[$i])
next

For example, this is a part of the INI created with this code:

[L:\Emuladores\ISOs\Sega Saturn (ISOs)\2do Arukotowa Sando-R (J)\Sando-R.cue]

Ruta=L:\Emuladores\ISOs\Sega Saturn (ISOs)\2do Arukotowa Sando-R (J)\Sando-R.cue

I need to change the $name code to another to create this:

[sando-R.cue]

Ruta=L:\Emuladores\ISOs\Sega Saturn (ISOs)\2do Arukotowa Sando-R [T-6802G] (J)\Sando-R.cue

I want to show only the filename of each line searched in the INI written by the script but I don't know how to modify $name to get the working code.

I hope you can help me. Thanks.

Share this post


Link to post
Share on other sites



Run "StringSplit" of your path by '\' and put the results into an array.

Your last array's cell should hold the file's name.

HTH,

YG

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Yargo, Thanks for the idea, I solved my problem with this code:

for $i=1 to $lines[0]-1
$nombresolo = StringSplit ($lines[$i], "\")
IniWrite("C:\Program Files\NeoBook 5\" & $CMDLine[2] & ".Ini", $nombresolo[5] , "Ruta", $lines[$i])
FileWriteLine ("C:\Program Files\NeoBook 5\" & $CMDLine[2] & " Names.Ini",$nombresolo[5])
next

Your help was perfect, thanks.

Edited by zarkok

Share this post


Link to post
Share on other sites

Hi.

For easy handling of files / dirs / files+dirs, optional recursively have a look for this snippet: _FileListToArrayFaster1e.au3

IIRC it was originally listed in "Sample Scripts". Some months ago I mentioned to integrate these funcions into _FileListToArray(), there you can find a copy of the original code I currently can't find any more:

http://www.autoitscript.com/trac/autoit/ticket/834

Regards, Rudi.

PS: the new "insert link" doesn't work for me any more, therefor I embedded the URLs "plain" (a popup opens, two input lines, no buttons)


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0