How to rename MULTIPLE files with Powershell
Вставка
- Опубліковано 23 сер 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 UA-cam and Twitch!
/ @mikoriko
/ miko_riko
---------------------------------------------------------------------------------------------------------------------------
Check out my Twitch!
/ zombiefaace
Follow me on Twitter for updates!
/ zombiefaaace
cmd's "ren" command stopped working for no reason...
This video saved me hours of work, thank you!
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
I feel the disclaimer at the font of the video. Everyone viewing this video knows EXACTLY what you are talking about. LOL
Thank you so much for this video, you've saved me so much time!
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
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.
@@AskANerdTV sweet. learning one liner scripts would save me loads of time if I could learn it
@@RobertJene Totally, and even more time if you can turn around and automate your process with it :D
@@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
Thanks again. saved heck of a time. Subscribing to your channel now.
Thanks for the EAR Raep... Nerd out on your sound levels... LOL
You a freaking savior. Lmao! had issues removing damn parenthesis.
5:35 it looks like a bracket parenthesis hole into a code dimension
This video looks like it was shot in 2007 lol
Thanks man!
quality content keep up the good work
Thanks my g your a life saver
No problem 👍
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?
Thank you friend.
Thanks for doing this
I get errors on every fricking step, typing same script word for word....
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?
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)
4:02 MEOW ALERT, MEOW ALERT
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 ??
Rename pdf file using content inside the pdf ...is it possible.????
FUCKING LIFE-SAVER! THANKS
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!!!
How about folders?
Can anyone read the command??
Umm... How do I undo? XD
I can't? Oh, okay, goodbye overwritten files!
Lmao this is hilarious