Windows 7 renaming a bunch of file

pawii

New Member
Joined
Apr 7, 2014
Location
jaipur
i had 200 file arranged in a serial order
i want to rename them by deleting the first 2 character of every file name
how can i do it??
 
Try Power shell

And Run this in your desired directory

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

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

When you want to remove the first Two characters, just replace the (1) after 'substring' with (2). In power shell, the whole filename is treated as a string(-object), points included.

If you find this answer helpful, then like this post
 
Back
Top Bottom