How to rename MULTIPLE files with Powershell

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ส.ค. 2024
  • Here's how to change the name of multiple files in a folder using a Powershell script, and remove the ( ) around the numbers if you're wanting it to look pretty. This could be really useful if you're needing to rename a bunch of .jpg's for a website or something.
    ---------------------------------------------------------------------------------------------------------------------------
    How to change the name of the files:
    Dir | Rename-Item -NewName {$_.name -replace "OLD-FILE-NAME-PART","NEW-FILE-NAME-PART"}
    How to remove the parenthesis:
    Dir | Rename-Item -NewName { $_.name -replace '[()]','' }
    ---------------------------------------------------------------------------------------------------------------------------
    Thanks to Miko Riko for the graphs and channel art! Check out his TH-cam and Twitch!
    / @mikoriko
    / miko_riko
    ---------------------------------------------------------------------------------------------------------------------------
    Check out my Twitch!
    / zombiefaace
    Follow me on Twitter for updates!
    / zombiefaaace

ความคิดเห็น • 34

  • @HBMHD
    @HBMHD 9 วันที่ผ่านมา

    cmd's "ren" command stopped working for no reason...
    This video saved me hours of work, thank you!

  • @RobertJene
    @RobertJene 4 ปีที่แล้ว +1

    a fancy code would:
    1. look for the number at the end
    2. verify that it is numeric
    3. set a string to be the same as the number you found
    4. if the number is less than ten change it to "0" + $newString
    5. rename all the files with the numbers, where numbers lower than 10 have a zero before
    example:
    file 01
    file 02
    file 10
    so they sort alphabetically

  • @michaellyman5248
    @michaellyman5248 2 ปีที่แล้ว

    I feel the disclaimer at the font of the video. Everyone viewing this video knows EXACTLY what you are talking about. LOL

  • @RobertJene
    @RobertJene 4 ปีที่แล้ว +2

    5:35 it looks like a bracket parenthesis hole into a code dimension

  • @RobertJene
    @RobertJene 4 ปีที่แล้ว +1

    basically a for-each with a replace "bla bla" with "new string"
    powershell is nice for one liners.
    I've been using vbscript for YEARS for stuff like this

    • @AskANerdTV
      @AskANerdTV  4 ปีที่แล้ว +2

      I usually run that in a .ps1 script, but I like to show examples in the videos and explain for those who may not understand, but personally, I just like all kinds of scripts.

    • @RobertJene
      @RobertJene 4 ปีที่แล้ว +1

      @@AskANerdTV sweet. learning one liner scripts would save me loads of time if I could learn it

    • @AskANerdTV
      @AskANerdTV  4 ปีที่แล้ว +2

      @@RobertJene Totally, and even more time if you can turn around and automate your process with it :D

    • @RobertJene
      @RobertJene 4 ปีที่แล้ว

      @@AskANerdTV I know right.
      VBS is like create an object
      set a thing is a folder...
      trype a loop for each the files...
      do testing with msgbox's telling you how it would change it (testing phase)
      ...ugh... your methond (once memorized) would take me 5 minutes instead of 15-20

  • @Ripdizzle01
    @Ripdizzle01 ปีที่แล้ว

    Thanks for the EAR Raep... Nerd out on your sound levels... LOL

  • @edisongarcia94
    @edisongarcia94 ปีที่แล้ว +2

    This video looks like it was shot in 2007 lol

  • @DanielWheeldon-jw6oc
    @DanielWheeldon-jw6oc 6 หลายเดือนก่อน

    Thank you so much for this video, you've saved me so much time!

  • @JimRohn-u8c
    @JimRohn-u8c 3 ปีที่แล้ว +2

    If i have 30 copies of a given file in my “Test” folder and I want to rename each file a different name.
    Is it possible to do this with PowerShell?
    If so do you have a video or resource I could look at to learn how to do that?

  • @MrLax-ob4zh
    @MrLax-ob4zh 2 ปีที่แล้ว

    You a freaking savior. Lmao! had issues removing damn parenthesis.

  • @elf
    @elf 3 ปีที่แล้ว +1

    Thanks my g your a life saver

  • @MrLax-ob4zh
    @MrLax-ob4zh 2 ปีที่แล้ว

    Thanks again. saved heck of a time. Subscribing to your channel now.

  • @predicationst405cp
    @predicationst405cp 10 หลายเดือนก่อน

    Thanks, but it does not work...or maybe I miss something. I want to change numbers. Instead of 1501 name, 1502 name,1503 name, I want 1301 name, 1302 name etc. Just changing 15 to 13 does not work. Does powershell needs a space after 15?

  • @malibelizec2543
    @malibelizec2543 3 ปีที่แล้ว +1

    Thanks man!

  • @ArthurMartins-jw8fq
    @ArthurMartins-jw8fq 3 ปีที่แล้ว

    quality content keep up the good work

  • @davidvillalba9482
    @davidvillalba9482 2 ปีที่แล้ว

    4:02 MEOW ALERT, MEOW ALERT

  • @noname-vv1vr
    @noname-vv1vr 8 หลายเดือนก่อน

    I get errors on every fricking step, typing same script word for word....

  • @joeburster
    @joeburster 2 ปีที่แล้ว

    Thanks for doing this

  • @laislyra5512
    @laislyra5512 ปีที่แล้ว

    I think I messed up my computer doing this. More than half of my shortcuts have disappeared from the desktop. Now I can't open Powershell and other programs. I guess I'm going back to a previous save of my computer. (I think it wasn't your fault, though. I think I really messed it up)

  • @BlueVideosBR
    @BlueVideosBR 2 ปีที่แล้ว

    Thank you friend.

  • @c4meo666
    @c4meo666 3 ปีที่แล้ว

    Does any know if you can move multiple files using one command line? such as: mv -force cherry.txt, orange.txt, grape.txt ? I use a automated scheduler and wanted to have the cherry.txt, orange.txt, and grape.txt be a variable.. so it would be mv -force but I dont think its possible ??

  • @JAY_SRI_HARI
    @JAY_SRI_HARI ปีที่แล้ว

    Rename pdf file using content inside the pdf ...is it possible.????

  • @georgizagorchev1589
    @georgizagorchev1589 3 ปีที่แล้ว

    FUCKING LIFE-SAVER! THANKS

  • @cipp7950
    @cipp7950 2 ปีที่แล้ว

    Select all files with Ctrl+A and on the first photo right click then rename how you want it.It will put numbers i think after your name.Gl!!!

  • @jamesparker6243
    @jamesparker6243 ปีที่แล้ว

    How about folders?

  • @minkya1010
    @minkya1010 ปีที่แล้ว

    Can anyone read the command??

  • @Protegit
    @Protegit ปีที่แล้ว

    Umm... How do I undo? XD

    • @Protegit
      @Protegit ปีที่แล้ว

      I can't? Oh, okay, goodbye overwritten files!

  • @tovape
    @tovape 3 ปีที่แล้ว

    Lmao this is hilarious