Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Script for adding text to filename

  • 26-12-2020 11:27AM
    #1
    Registered Users, Registered Users 2 Posts: 1,191 ✭✭✭


    i have numerous folders with files that i need to append to the file name.

    e.g old file name = application.pdf new file name = document application.pdf

    ideally i would like a a script that i can drag into the folder , run it and then it is done.

    any ideas.


Comments

  • Closed Accounts Posts: 2,909 ✭✭✭begbysback


    powershell


  • Registered Users, Registered Users 2 Posts: 2,104 ✭✭✭boombang


    Make a .bat batch file with

    Ren "OldFileName.pdf" "NewFileName.pdf

    I think there are options for sub directories. Etc. Use print to get a list of all the relevant files to make your batch file from.


  • Registered Users, Registered Users 2 Posts: 1,191 ✭✭✭tritriagain


    but wont that rename file completly i only want to add some text to the original name


  • Registered Users, Registered Users 2 Posts: 4,277 ✭✭✭km991148


    but wont that rename file completly i only want to add some text to the original name

    On phone so can't test.
    Assuming windows:

    ren *.mp3 ?text.mp3

    Full example/ explanation from

    https://superuser.com/a/1006827


    But of course test in a dummy directory first!


  • Registered Users, Registered Users 2 Posts: 2,104 ✭✭✭boombang


    km991148 wrote: »
    On phone so can't test.
    Assuming windows:

    ren *.mp3 ?text.mp3

    Full example/ explanation from

    https://superuser.com/a/1006827


    But of course test in a dummy directory first!

    This is better and more flexible, but will only be suitable if you want to rename all the files of a given extension.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,104 ✭✭✭boombang


    but wont that rename file completly i only want to add some text to the original name

    Use a text editor to add what you want to the original file names. I'd recommend using notepad++ for a handy edit of the file names.


  • Registered Users, Registered Users 2 Posts: 4,423 ✭✭✭smuggler.ie


    Have a look here


  • Posts: 188 ✭✭ [Deleted User]


    There is a (free for personal use) Bulk Rename utility... the interface is a bit of a mess but been using it for nearly 10 years and no problems.

    Once you get your head around the interface, it'll do just about anything you want - and you can also preview changes before committing.

    https://www.bulkrenameutility.co.uk/


  • Registered Users, Registered Users 2 Posts: 6,318 ✭✭✭kirving


    And before running any automated script to rename stuff, copy the files to an external drive (or at least another folder) and do your work in a safe place.

    Then go back and replace the old files with the newly renamed copies.


  • Registered Users, Registered Users 2, Paid Member Posts: 21,529 ✭✭✭✭Alun


    This one I use, the free Lite version is plenty good enough.

    http://www.den4b.com/products/renamer


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 180 ✭✭Philipx


    I use this a lot for photo etc

    Batch File Renamer


  • Registered Users, Registered Users 2 Posts: 2,997 ✭✭✭Adyx


    There's a Microsoft Power Toy called Power Rename that should do it.


Advertisement