Copy MOVE * TO "%RENAME_TARGET%"
Go PATH ".." DUALPATH "%RENAME_TARGET%"
rmdir {$OriginalSource}
But surely it's a dangerous Button this way. No Problem to use it by mistake on Folders containing no MP3-files because you'll get an error message. Otherwise it will move erything to my Music directory...
I tried the above before reading your last post. This way it worked, but does a second Move-action. With your additionally strNewName = "" it's perfekt now. Thanks again and again!
If you click that button in a folder without any music files then it'll move the current folder's contents to whatever the previous music destination was, if you had used the button since starting Opus. Else it would use an empty destination, which I don't think will do anything (not sure, actually).
You could make it a bit safer by adding this right after the Set EnvVars = Shell.Environment("PROCESS") line:
EnvVars("RENAME_TARGET") = "zzzzz:\"
That sets the default destination to zzzzz:\ which is an impossible path and will result in an error message instead of anything happening. The destination will be left that way if the rename script doesn't get to run for any files.
Just for Fun I added a Line calling my favourite music player to play all files in "%RENAME_TARGET%" right behind the rmdir {$OriginalSource} command.
Worked on the first try.
Here's the simple Code (using Aimp2):
Ah, true. Well, you can always do both, so the Rename command takes care of the MP3 files and then a Copy MOVE command moves any additional files which are still leftover.
BTW, I edited your post above to put quotes around the AIMP2.exe path. Makes it work if something creates a folder called "C:\Program" (which happens every so often).
WOW NICE WORK ... I know you said no questions but what happens if there are no tags ? I did not see it .. I will try it with a file that has no tags.. I asked it here so its under the same place just in case someone wants to know... update I just tried on a file with no tags . all i got was a file named 13.mp3 ... so a bit scary can it be updated to take no actions on files with no tags
can we have a nice new version of this please ? or is this something better already i have not asked about for sometime even if it could be updated not to move files / folders with blank tags thanks again
It doesn't seem to be picking up the track info on the files. I have checked and the files are tagged with ID3v2.3 tag format. I tried retagging so they also have ID#v1 as well
It doesn't seem to create the folder based on the artist and album name.
It creates a single file with no name on the first file and then the second file generates a renaming error: "Cannot create a file when that file already exists"
Also, I notepad text is generated and opened when the process completes: dop201912132119220083.bat
echo off
chcp 1252 > nul
D:
cd "\Downloads"
rmdir D:\Downloads\Gong_-_The_Universe_Also_Collapses_(2019)
Just in case, here's the script I've used for years but I did just grab the one from the forums here, created a new button and get the same results
@noexpandenv
@runmode hide
@set OriginalSource={sourcepath$|noterm}
Rename FILEINFO FROM "*.mp3" TO "{alias|mymusic}\{mp3artist}\{mp3album}\{mp3track|#2} - {mp3title}.{ext}"
Go PATH ".." DUALPATH "%RENAME_TARGET%"
rmdir {$OriginalSource}
@script vbscript
Option Explicit
Dim fs
Set fs = CreateObject("Scripting.FileSystemObject")
Dim Shell
Set Shell = CreateObject("WScript.Shell")
Dim EnvVars
Set EnvVars = Shell.Environment("PROCESS")
Function Rename_GetNewName(strFileName, strFilePath, fIsFolder, strOldName, ByRef strNewName)
' Fix any double \ chars resulting from empty tags (e.g. no genre).
' If we don't do this, things can get confused about the destination path.
strNewName = Replace(strNewName, "\\", "\")
' Set the %RENAME_TARGET% environment variable to the folder we're moving the file to.
' This can be used in the main command above to go to the folder.
' Note that we use "@noexpandenv" at the top of the command; if we didn't then %RENAME_TARGET%
' would be expanded *before* this script had run, which obviously would not work.
EnvVars("RENAME_TARGET") = fs.GetParentFolderName(strNewName)
End Function