#1 2022-01-24 15:32

wpemployer
Member
Registered: 2022-01-24
Posts: 6

Foldername from Filename

How can I get a renaming on existing Foldername based on the filename laying inside ?

I have a folder named BBM001
Inside Folder BBM001 is a file named "Artistname_-_Trackname.wav"

I want the result:

Foldername: BBM001_Artistname_-_Trackname"

The renamer should get the name for the folder from its trackname laying inside.
I tried many things even the metatag file_Filename to manually renamed to :Folder_Filename...  smile)

But did not work.
Help is highly appreciated smile
Stay safe and healthy.
Hugs,
Tom

Offline

#2 2022-01-26 13:28

wpemployer
Member
Registered: 2022-01-24
Posts: 6

Re: Foldername from Filename

Please let me know if this is not possible or there is no solution for my task then I do not wait here anymore smile

Offline

#3 2022-01-26 20:40

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,108

Re: Foldername from Filename

Why do you wait?

Why not do something yourself and search before posting?

https://www.den4b.com/forum/viewtopic.p … 007#p10007
https://www.den4b.com/forum/viewtopic.p … 029#p11029
https://www.den4b.com/forum/viewtopic.p … 6872#p6872




The question for your issue is, how can we know to get the right file, and next, how to detect the "Trackname" on that file?

We need some common anchor points from you.

Or is there always only one file? Or at least only one wav file?
And is the Trackname always the part after the last underscore till the end?

Next, how is the folder hierarchy,  all folders in one main folder, or are there sub folders?


EDIT:
Ah, I see: not the Trackname but the the whole file name w/o extension as addition to the folder name.
OK, this part is understood now:

wpemployer wrote:

Inside Folder BBM001 is a file named "Artistname_-_Trackname.wav"

I want the result:
Foldername: BBM001_Artistname_-_Trackname"

The renamer should get the name for the folder from its trackname laying inside.



.


Please see HELP and MANUAL in Wiki for more info.
If ReNamer had helped you, please donate a coin to Denis or buy a Pro license for commercial use. (Lite vs Pro)

Offline

#4 2022-01-27 13:17

wpemployer
Member
Registered: 2022-01-24
Posts: 6

Re: Foldername from Filename

Hi Stefan,
thanks for the reply. I "wait" as I have to tag 8.000 Folders and I do not want to make it manually and therefore I waited every day for a solution or some response from your side or the community. No offence but I did not know to "search" the forum and your topics reach back to 2019 and 2017. I checked only until 2020 and guessed my request is too special or unneeded. Sorry for that.

It is always ONE FOLDER with ONE WAV FIle.
The Folders have NO subfolders.
I already gave the folders serial numbers 001,002,003 etc.
Now I need to fulfill 001 with the artistname and trackname from the file laying inside the folder 001.


So for example in Folder 001 lays audio file:
Artistname_-_Trackname.wav

Source:
001 (Foldername)
         -  Wpemployer_-_Cool_Track.wav

I need as end result:
001_Wpemployer_-_Cool_Track



You already have a task where you can rename the FILE by the FOLDER SOURCE. I need the OTHER WAY AROUND. Rename Foldername by FILE SOURCE.

Thanks for your patience. I would not ask if it would be for fun or testing smile)
Best,
Tom

Offline

#5 2022-01-27 13:19

wpemployer
Member
Registered: 2022-01-24
Posts: 6

Re: Foldername from Filename

Also checked the 3 links.
One is refereing to subfolders based on a mkv file.
Second is for renaming folders but not from a file.
Third is retrieving info from ID MP3 Tag. But due the fact I have wav files it will not containg and ID TAG.
sad

Offline

#6 2022-01-27 21:02

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,108

Re: Foldername from Filename

FROM:
D:\rive\Folder\001\Artistname_-_Trackname.wav
D:\rive\Folder\002\Wpemployer_-_Cool_Track.wav

TO:
D:\rive\Folder\001_Artistname_-_Trackname\Artistname_-_Trackname.wav
D:\rive\Folder\002_Wpemployer_-_Cool_Track\Wpemployer_-_Cool_Track.wav

USE:
1) We gonna use the script from first link ( https://www.den4b.com/forum/viewtopic.p … 007#p10007 )
2) We adjust it slightly to our needs (see below)
3) Adjust your Filter Settings in ReNamer to "Add folders as files"
4) Add your folders to ReNamer via "Add Folders" or by drag&drop (if we had sub folders we would rename from lowest to top)
5) Add a PascalScript rule and add the below script
6) Press Preview and rename if fine for you

Read our wiki (link above) for a manual and for this special issue the link at 1) too.



var
  Files: TWideStringArray;
  FileExt: WideString;
  IsMovieFile: Boolean;
  I: Integer;

begin
  if WideDirectoryExists(FilePath) then
  begin
    SetLength(Files, 0);
    WideScanDirForFiles(FilePath, Files, False, False, False, '');
    for I := 0 to Length(Files) - 1 do
    begin
      FileExt := WideLowerCase(WideExtractFileExt(Files[I]));
      IsMovieFile :=
        (FileExt = '.mkv') or
        (FileExt = '.avi') or
        (FileExt = '.wav') or
        (FileExt = '.mp4');
      if IsMovieFile then
      begin
        FileName := FileName + '_' + WideExtractBaseName(Files[I]);
        Break;
      end;
    end;
  end;
end.   

.


Please see HELP and MANUAL in Wiki for more info.
If ReNamer had helped you, please donate a coin to Denis or buy a Pro license for commercial use. (Lite vs Pro)

Offline

#7 2022-01-28 13:20

wpemployer
Member
Registered: 2022-01-24
Posts: 6

Re: Foldername from Filename

WOOOOOOOOOOOOOOOOOOOOOW

IT WORKED !!!
Thanks a lot for the help.

You save us ton of time and headaches and human mistakes.
Is there a coffee donation site or donation paypal you have - I would like to thank you on that way for that amazing fast response and support.

Hugs,
Tom

Offline

#8 2022-01-28 16:45

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,108

Re: Foldername from Filename

wpemployer wrote:

WOOOOOOOOOOOOOOOOOOOOOW

IT WORKED !!!
Thanks a lot for the help.

You save us ton of time and headaches and human mistakes.
Is there a coffee donation site or donation paypal you have - I would like to thank you on that way for that amazing fast response and support.

Hugs,
Tom



Tom, what can I say more than "please read my signature"





.


Please see HELP and MANUAL in Wiki for more info.
If ReNamer had helped you, please donate a coin to Denis or buy a Pro license for commercial use. (Lite vs Pro)

Offline

Board footer

Powered by FluxBB