Author Posts

July 12, 2018 at 4:59 am

Hi there, Im having some difficulty in my renaming of a mp3 file.

I want the renamed as the following style(theres 2 spaces before mark): {118-Cmin} Mark Alow – Black Light (Original Mix).mp3

In my switch statement I have the following code. I'm finding it hard to use the "{" additionally with variables to get the rename the way I want it. Any hints would be greatly appreciated.


 'Minimal / Deep Tech' {

                      if (Test-Path "$destinationVar\Minimal") {
                    
                      $newName = $bpm + $key + ' ' + $artist + $title 
                      Rename-Item -NewName { $_.name -Replace $newName 
                     
                     pause 
                       
                      Move-Item $file -destination "C:\Beatport Collection\Minimal" }
                 
                                                            }

July 12, 2018 at 1:37 pm

I'm not following the code at all, unfortunately.

What I usually do is just include subexpressions within double quotes.

$var = "$($this_variable).$($another)"

The $() subexpression can contain whatever code you like, while outside the $() can contain whatever literal characters you want. It's much easier than concatenating strings.

Hope that helps.