'====================================================================
' Переместить выделенные mp3 в папки "...\<Год> - <Артист>\<Альбом>\"
' Параметры: %L "<путь назначения>" <флаг жанра>
' Пример: %L "%T" 1
' Флаг жанра = <Жанр>\<Год> - <Артист>\<Альбом>
'====================================================================
With WScript.Arguments
C = .Count : If C = 0 Then Wsrcipt.Quit
List = .Item(0) : Path = .Item(1)
End With
If Right(Path, 1) <> "\" Then Path = Path & "\"
With CreateObject("Scripting.FileSystemObject")
For Each F in Split(.OpenTextFile(List, 1).ReadAll, vbNewLine)
If F <> "" Then
If .FileExists(F) And StrComp(.GetExtensionName(F), "mp3", 1) = 0 Then
Set Fd = CreateObject("Shell.Application").NameSpace(.GetParentFolderName(F) & "\")
Name = .GetFileName(F) : Set PN = Fd.ParseName(Name)
Artist = Fd.GetDetailsOf(PN, 20) : AYear = Fd.GetDetailsOf(PN, 15)
If AYear <> "" Then AYear = AYear & " - " : Album = AYear & Fd.GetDetailsOf(PN, 14)
If Artist <> "" Then
Ren Artist : Ren Album
If C = 3 Then
Genre = Fd.GetDetailsOf(PN, 16)
If Genre = "" Then Genre = "Other" Else Ren Genre
GenPath = Path & Genre : Genre = Genre & "\"
If Not .FolderExists(GenPath) Then .CreateFolder(GenPath)
End If : AlbPath = Path & Genre & Artist : ArtPath = AlbPath & "\" & Album
If Not .FolderExists(AlbPath) Then .CreateFolder(AlbPath)
If Not .FolderExists(ArtPath) Then .CreateFolder(ArtPath)
If Not .FileExists(ArtPath & "\" & F) Then .MoveFile F, ArtPath & "\"
End If
End If
End If
Next
End With
Sub Ren(T)
R T, "*", "_" : R T, "|", "-" : R T, ":", " -" : R T, ";", "," : R T, "\", "_"
R T, "/", "_" : R T, "<", "_" : R T, ">", "_" : R T, "?", "_" : R T, "?", "_"
End Sub : Sub R(N, A,
: N = Replace(N, A,
: End Sub