Sign in to follow this  
Followers 0
quicksilver

Dateinamen Extrahieren bis zum -

15 posts in this topic

Hallo ich habe einen Ordner in dem sich mehrere hunderte mp3z befinden. Diese sind wie folgt benannt:

Interpret - Titel.mp3

Ich möchte nun den Interpreten aus dem Dateinamen auslesen Für den Interpreten ein Ordner erstellen. Das Mp3 File dort dann reinverschieben. Also das mit dem Ordner usw bekomme ich ja hin aber das Extrahieren des Interpreten ist mein Problem.

Vielen Dank für die HIlfe!

Share this post


Link to post
Share on other sites



Hi

Probier mal Magic Mp3 Tagger das Programm macht so ziemlich dasselbe.

Noch n kleiner Tipp am Rande, wenn du englisch schreibst kriegst du bestimmt mehr antworten als in Deutsch.

Share this post


Link to post
Share on other sites

Ja aber das tool ist shareware. Und kann wieder viel zu viel.. möchte nur diese Funktion.

Share this post


Link to post
Share on other sites

I'm not good at german. But here's a bit of example code:

$filename = "Interpret - Titel.mp3"
$array = StringSplit($filename, "-.")
For $x = 1 to $array[0]
    $Output = StringStripWS($array[$x],3)
    MsgBox(0, "Example code: ", $Output)
Next

Your next step would be to understand what each function does, and rewrite this so that it fits your needs.

Share this post


Link to post
Share on other sites

quicksilver, your previous topics were in english. So why the change?

Share this post


Link to post
Share on other sites

ok Thx :lmao: thats the command i need :ph34r:

Share this post


Link to post
Share on other sites

Hi,

na da scheint dir ja schon geholfen.

PS: es gibt auch ein gutes Deutsches Forum

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Hehe No Problem :geek:

Now here ist the mini Tool to "Organize" the mp3 Files :lmao:

Has anyone a tip to complete the tool? Errors? Bugs? ..?

Thx for help :ph34r:

#include <file.au3>
$filenames = @ScriptDir&"\*.mp3"
$search = FileFindFirstFile($filenames)  

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "Keine Mp3 Dateien gefunden")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search) 
    If @error Then ExitLoop
    $rdyname = StringSplit($file,"-.")
    $folder = @ScriptDir&"\"&$rdyname[1]
    DirCreate($folder)
    $filesource = @ScriptDir&"\"&$file
    $filemove = @ScriptDir&"\"&$rdyname[1]&"\"&$file
    FileMove($filesource, $filemove)
WEnd

; Close the search handle
FileClose($search)
Edited by quicksilver

Share this post


Link to post
Share on other sites

Hm theres a Problem.

He creates the folders. But when he trys to copy the File is a blank in the rdyname variable. And when he trys to Copy the file from $filesource to $filemove the Foldername of the Filemove is Wrong because the Blank is too much.

Eg.

Wrong:

c:\test\Artist - Title.mp3 => c:\test\Artist \Artist - Title.mp3

Right:

c:\test\Artist - Title.mp3 => c:\test\Artist\Artist - Title.mp3

In the Variable $rdyname[1] is a Blank to much :lmao:

Share this post


Link to post
Share on other sites

HI,

my try:

#Include <File.au3>

$FileList = _FileListToArray(@ScriptDir, "*.mp3", 1)
If (Not IsArray($FileList)) And (@error = 1) Then
    MsgBox(0, "", "No Files\Folders Found.")
    Exit
EndIf

For $i = 1 To UBound($FileList) - 1
    $r = StringSplit($FileList[$i], " - ")
    DirCreate(@ScriptDir & "\" & $r[1])
    FileMove(@ScriptDir & "\" & $FileList[$i], @ScriptDir & "\" & $r[1])
Next

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Fine but.. with this code ist Only the First Name of the Artist the Name of The Folder.. not the Full name..

Like:

Justin but right is Justin Timberlake

Share this post


Link to post
Share on other sites

Hi,

try without the blanks.

#Include <File.au3>

$FileList = _FileListToArray(@ScriptDir, "*.mp3", 1)
If (Not IsArray($FileList)) And (@error = 1) Then
    MsgBox(0, "", "No Files\Folders Found.")
    Exit
EndIf

For $i = 1 To UBound($FileList) - 1
    $r = StringSplit($FileList[$i], "-")
    DirCreate(@ScriptDir & "\" & $r[1])
    FileMove(@ScriptDir & "\" & $FileList[$i], @ScriptDir & "\" & $r[1])
Next

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Works Better :lmao::ph34r:

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