none
Powershell script and renaming files

    Question

  • Hay folks, I'm new to here and powershell so forgive the noob and dumb questions....

    I'll include my script below but in short, I have been producing media for many years, and in many formats.  I am now low on drive space so been converting it all to HEVC/x265 WAV/MP3 (hay for that matter, CD, MiniDisk and Tapes to MP3) etc but wish to update the file names.

    1, I want to ask for user input (ie folder location) and for the script to include all files in the sub folders too.

    2, I'd like to see a better output at the end, either to a text file (detailed list for example), output in screen (just x files found and x changes made).

    3, The pause command needs enter - I was hope for any key so may be you have a better idea - and I thought you could change the message pause displays??  Could in my old days in DOS I'm sure!

    4, as a separate issue, I in some cases need to alter the format of the title, moving the first "word" ie A  The  I  , and might need to be done in a separate routine.  A good example of this is think about music and mp3.  The Beatles - Sgt. Pepper's Lonely Hearts Club Band - I wish to move the first word "The" so as to read,      Beatles (The) - Sgt. Pepper's Lonely Hearts Club Band
    This is a good example, as it is always a fixed preset such as "The" and would be entered in to brackets but it's how to define where to move first word too.  My formats generally match the following.

    So an example is an advert project so its the folder I wish to change,      The Movie Man (2018)

    Would become                                                                                            Movie Man (The) (2018)

    Or example my backing music,  The cold wild world - Instrumental (2004) - DP a TW Studio 11-5-2004 - WAV

    Will become                               Cold wild world (The) - Instrumental (2004) - DP a TW Studio 11-5-2004 - WAV

    and with the other changes it would become (see below!)   Cold wild world (The) - Instrumental (2004) - DP a TW Studio 11-5-2004 - MP3 Re-Encoded 2019

    This is what I came up with so far and thanks in advance!!

    echo off
    cls

    Write-Output "


    Hi. This edit's any files in a given folder renaming and removing information from all the files in the folder.


    "

    $drive = read-host "Input Source Files to edit"

    CD "$drive"

    get-childitem *.*| foreach { rename-item $_ $_.Name.Replace("WAV", "MP3 Re-Encoded 2019") }

    cls

    Write-Output "

    Ok then, what ever matched my pre-defined list has now been changed.

    Press Enter key to continue and close / end this operation.

    "
    pause


    • Edited by DeamonPup Friday, January 11, 2019 9:28 AM
    • Moved by Bill_Stewart Friday, March 15, 2019 5:33 PM This is not "scripts on demand"
    Friday, January 11, 2019 9:23 AM

All replies