The Computer Oracle

How can I remove the first character from all filenames in a folder?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 5 Looping

--

Chapters
00:00 How Can I Remove The First Character From All Filenames In A Folder?
00:24 Accepted Answer Score 36
00:59 Answer 2 Score 11
01:43 Answer 3 Score 2
02:02 Answer 4 Score 1
02:25 Answer 5 Score 1
02:46 Thank you

--

Full question
https://superuser.com/questions/273215/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows7 #rename

#avk47



ACCEPTED ANSWER

Score 36


again, try powershell ;)

Run this in your desired directory:

get-childitem *.txt | rename-item -newname { [string]($_.name).substring(1) }

Explanation:
- get-childitem *.txt collects all *.txt-files in the actual directory.
- rename-item -newname renames the piped results from the get-childitem command with the string that is generated in {}
- [string]($_.name).substring(1) takes the filename starting after the first character




ANSWER 2

Score 11


Forget about complicated scripts for this.

rename is a very old and never properly completed command.  If you do not use it properly, the result might surprise you.

For example to remove a prefix abcd from abcd1.txt, abcd2.txt, abcd3.txt etc. in order to get 1.txt, 2.txt, 3.txt simply use

rename "abcd*.txt" "////*.txt"

You need the same number of / as the number of initial characters you would like to remove.  So, for your specific situation, you would use

ren "_*.txt" "/*.txt"

Do use double quotes for both arguments.




ANSWER 3

Score 2


If you want to avoid having to write anything, try the Bulk Rename Utility. The interface can be quite scary at first but just have a play around with it and you'll see it's not actually hard to use at all.




ANSWER 4

Score 1


Just if anyone needs in future: I use 1-4 rename. It is fast, does not have to be installed. When you run it hit F2 for advanced mode and you can tell it to kill the first 4 characters. Below is the link to the program.

Download Link: http://www.1-4a.com/rename/




ANSWER 5

Score 1


in 2020 I had the same bulk rename problem: Remove fixed string of random characters for a lot of names.

Used this code in the Command Promt:

Rename "?????*.*" "*/////*.*"

(Remove any 5 characters) (You have tu use ")

Work perfet, thanks guys from de past.