Author Topic: All files deleted by bad script!?  (Read 502 times)

Retrodude

  • Newbie
  • *
  • Posts: 3
Hi -

something horrible happened today when I tried to re-organize my files: It appears that musicbee deleted 189,000 music files when I tried to re-organize them with the following script:

$If(<Genre>="Classical","Classical")\$Group($Sort(<Album Artist>),1)\$Sort(<Album Artist>)\<Year> - <Album>\$IsNull(<Disc-Track#>,, <Disc-Track#>" ")<Title>

The drive on which the music files were stored is practically empty except a few folders with artwork.
Has the first command in the script killed it all? At first the path location in the musicbee editor said the missing music was stored in the depth of the following folder path:
$If(Genre="Classical","Classical")
$Group($Sort(<Album Artist>),1)
$Sort(Album Artis)
Year -Album

But there is nothing except stray artwork. I closed Musicbee and reopened it and - alas - suddenly the library comprised of 12 remaining music tracks. The recycle bin was/is empty.
Looks like I  fucked up royally :(  (Yes, I know - I am stupid for not having a recent backup of my database (last is 6 months old)...)

Question: Is there any possible way to reverse this apparent deletion through Musicbee itself? Or is my last resort a file recovery program? Before I invest I need to assess my options and chances

Your help and advise is appreciated!


Steven

  • Administrator
  • Hero Member
  • *****
  • Posts: 34999
First off MB doesnt normally delete files in the file organiser - it moves them. The one exception is if you ticked 'allow existing files to be replaced' where in the case the target filename already exists, its deleted to the recycle bin.

If thats the naming template you used then it is invalid - specifically $If(<Genre>="Classical","Classical") is not valid syntax
You should have seen that in the organiser panel which shows the new name the file will be renamed to.

Trying it myself now, you get several warnings that the filenames are duplicated but if you proceed anyway it sends the first file to:
<path of 'to folder'>\$If( Genre = Classical , Classical )\$Group($Sort( Album Artist ),1)\$Sort( Album Artist )\Year  -  Album\$IsNull( Disc-Track# ,,  Disc-Track#    ) Title .m4a
All other files are not moved because they duplicate to the first file. You also get an error message at the end.

So it doesnt tally with what you are saying so i suspect you have missed out stating some things you did

You can try using Edit/ Undo/ File Move... but if you did tick 'allow existing files to be replaced' it wont work
Last Edit: April 11, 2023, 01:09:00 PM by Steven

MotleyG

  • Full Member
  • ***
  • Posts: 215
...for not having a recent backup of my database (last is 6 months old)
Please say that you at least have a backup of the audio files, even if that is 6 months old, perhaps less any metadata changes? Unleashing an untested renaming formula on an entire library this big without a backup is really tempting fate. :o

Retrodude

  • Newbie
  • *
  • Posts: 3
First off MB doesnt normally delete files in the file organiser - it moves them. The one exception is if you ticked 'allow existing files to be replaced' where in the case the target filename already exists, its deleted to the recycle bin.

If thats the naming template you used then it is invalid - specifically $If(<Genre>="Classical","Classical") is not valid syntax
You should have seen that in the organiser panel which shows the new name the file will be renamed to.

Trying it myself now, you get several warnings that the filenames are duplicated but if you proceed anyway it sends the first file to:
<path of 'to folder'>\$If( Genre = Classical , Classical )\$Group($Sort( Album Artist ),1)\$Sort( Album Artist )\Year  -  Album\$IsNull( Disc-Track# ,,  Disc-Track#    ) Title .m4a
All other files are not moved because they duplicate to the first file. You also get an error message at the end.

So it doesnt tally with what you are saying so i suspect you have missed out stating some things you did

You can try using Edit/ Undo/ File Move... but if you did tick 'allow existing files to be replaced' it wont work

Thanks, for your comprehensive  response Steven. I am afraid I made  all the  mistakes (incl. ticking "allow existing files to be  replaced"). Am now recovering the  deleted  files with a "Recuva". Lesson learned.

Coming from Mediamonkey, I was at first happy with the speed of Musicbee. But I have to say I find the multitude of customization options overwhelming and at times frustrating. I am not a programmer and just want a potent music organizer without having to learn coding. Result: shit happened.

Anyway: Many  thanks for your response, again!

Retrodude

  • Newbie
  • *
  • Posts: 3

[/quote]
Please say that you at least have a backup of the audio files, even if that is 6 months old, perhaps less any metadata changes? Unleashing an untested renaming formula on an entire library this big without a backup is really tempting fate. :o
[/quote]

Yes, this data loss is a painful reminder of that simple rule. Just got impatient with lost file paths, an  unwanted "default" folder structure created by musicbee and all the cryptic scripting tasks.
I do, thankfully, have a backup - but  it's 6 months old and a lot of metadata and new files are missing. Hopefully the file recovery program will do its job well...

Thanks for responding!

Zak

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2553
...an  unwanted "default" folder structure created by musicbee and all the cryptic scripting tasks.
That sounds like you also enabled Auto-Organise without understanding the implications.
Using default settings, MusicBee will just add your existing files to its library/database.
It won't move files or create new folders.

Unless you have specific needs, it also shouldn't be necessary to use any of the advanced scripting or tagging features just to use MusicBee as a player.
Bee excellent to each other...