1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Windows Adding prefix to multiple files

Discussion in 'Software' started by adidan, 9 Sep 2020.

  1. adidan

    adidan Guesswork is still work

    Joined:
    25 Mar 2009
    Posts:
    19,804
    Likes Received:
    5,591
    Hey all.

    Just moved my OH over to a new phone and sd card. Moved the photos over that can be seen in the file system but only ones with an 'IMG_' prefix will show via the camera app.

    Anyway to add the 'IMG_' prefix to multiple files in W10 all at once rather than one by one?

    Cheers :thumb:
     
  2. Gareth Halfacree

    Gareth Halfacree WIIGII! Lover of bit-tech Administrator Super Moderator Moderator

    Joined:
    4 Dec 2007
    Posts:
    17,132
    Likes Received:
    6,728
    Go into Windows Subsystem for Linux, find the files, and type: for i in *jpg; do mv $i IMG_$i; done
    Use xargs if you want to speed things up.

    If you'd rather use command.com (or cmd.exe, whatever): for %a in (*.jpg) do ren "%a" "IMG_%a"

    If you're a PowerSheller: dir *.jpg | Rename-Item -NewName {"IMG_" + $_.Name}

    EDIT:
    Oh, but be aware that it'll happily work multiple times - so if you've files in there that already start with IMG_, they'll become IMG_IMG_. Could add a filter to remove any files starting IMG_ already; could just move 'em into a "done" folder first then move 'em back again afterwards.
     
    Last edited: 9 Sep 2020
    adidan likes this.
  3. wyx087

    wyx087 Homeworld 3 is happening!!

    Joined:
    15 Aug 2007
    Posts:
    11,994
    Likes Received:
    714
    adidan and MadGinga like this.
  4. MadGinga

    MadGinga oooh whats this do?

    Joined:
    19 Mar 2009
    Posts:
    2,702
    Likes Received:
    522
    wyx087 and adidan like this.
  5. adidan

    adidan Guesswork is still work

    Joined:
    25 Mar 2009
    Posts:
    19,804
    Likes Received:
    5,591
    Cheers all, i'll give them a go later.

    Glad I asked, been fruitlessly googling like my gran this morning.
     
  6. adidan

    adidan Guesswork is still work

    Joined:
    25 Mar 2009
    Posts:
    19,804
    Likes Received:
    5,591
    Had a spare 5 minutes and that worked a treat, thanks! :thumb:

    Not sure how i've missed this handy program over all these years.
     
    wyx087 likes this.
  7. RedFlames

    RedFlames ...is not a Belgian football team

    Joined:
    23 Apr 2009
    Posts:
    15,425
    Likes Received:
    3,011
    Install powertoys

    Code:
    winget install powertoys
    use PowerRenamer

    EDIT: late to the party but... meh...
     
    adidan likes this.
  8. adidan

    adidan Guesswork is still work

    Joined:
    25 Mar 2009
    Posts:
    19,804
    Likes Received:
    5,591
    Thanks @RedFlames - Advancedrenamer did the trick but it's always handy to have options.
     

Share This Page