how to delete first ten characters of file names in folder

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
umapati
Posts: 12
Joined: 11 Aug 2011 13:40

how to delete first ten characters of file names in folder

Post by umapati »

How can I delete the first ten characters of file name of all files in a folder?
And how to delete particular characters in file name of all files in a folder?

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: how to delete first ten characters of file names in fold

Post by yusef88 »

umapati wrote:How can I delete the first ten characters of file name of all files in a folder?
New RegExp Rename command

Code: Select all

(.{10})(.+) > $2

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: how to delete first ten characters of file names in fold

Post by highend »

In the same way like in the post before...

E.g.:

Code: Select all

(y|4) > 
There is a space after the ">" character!

This would delete all "y" and all "4" characters for all selected files.
One of my scripts helped you out? Please donate via Paypal

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: how to delete first ten characters of file names in fold

Post by bdeshi »

umapati wrote:And how to delete particular characters in file name of all files in a folder?
Since some chars might collide with RegExp's specials, I suggest you try Rename Special -> Search and Replace. (the (!) hint button has helpful syntax examples.)
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

umapati
Posts: 12
Joined: 11 Aug 2011 13:40

Re: how to delete first ten characters of file names in fold

Post by umapati »

Many thanks to yusef88, highend, and SammaySarkar.

Jeff
Posts: 2
Joined: 17 Oct 2015 12:29

Re: how to delete first ten characters of file names in fold

Post by Jeff »

Hi,

is there any simpler way than doing any length related renaming operations via regex? For instance, what about: delete two characters of the original filename, take the next 20 characters and add some words. It seems simple in other renamers...

Furthermore, is there some documentation about the RegEx syntax? Or the specification used? For instance, I'm used to "\1" for group back references instead of $1, and of course it didn't work.

Thanks

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: how to delete first ten characters of file names in fold

Post by highend »

is there any simpler way than doing any length related renaming operations via regex? For instance, what about: delete two characters of the original filename, take the next 20 characters and add some words.
No.
Furthermore, is there some documentation about the RegEx syntax? Or the specification used?
XY uses vbscript.dll for regular expressions. To get the full specifications -> google.
One of my scripts helped you out? Please donate via Paypal

autocart
Posts: 1356
Joined: 26 Sep 2013 15:22

Re: how to delete first ten characters of file names in fold

Post by autocart »

Jeff wrote:is there any simpler way than doing any length related renaming operations via regex?
Besides highend's answer, Jeff, maybe this post might be of use: http://www.xyplorer.com/xyfc/viewtopic. ... 54#p130354. Save the code once, maybe directly under user-commands or in separate xys-files and then put them on a user button or call them through the user-commands menu or in whatever other way.
Jeff wrote:For instance, what about: delete two characters of the original filename, take the next 20 characters and add some words.
This would be a 2-step process then. 1st) Delete 2 chars. The files should normally stay selected. 2nd) Then add some words. I agree that XY should have the 1st one implemented by factory default. But doing these 2 steps consecutively makes no real difference compared to doing it in one operation, IMO. You think otherwise?
Jeff wrote:It seems simple in other renamers...
I agree.
Jeff wrote:Furthermore, is there some documentation about the RegEx syntax? Or the specification used? For instance, I'm used to "\1" for group back references instead of $1, and of course it didn't work.
This is another weakness of XY. So far I was using as reference: http://www.regular-expressions.info/vbscript.html and this forum. You can put the hyperlink also into the XY-catalog if you want to (1-click-fast-access).

Post Reply