darklitch Posted November 12, 2006 Share Posted November 12, 2006 (edited) I have an array of filenames called $mpgall my video files are name with MOVXXXXX.MPG where the x's are numbers. I would like to add 4000 to every number in the array then rename all the files with that new number. How can i do this? I am guessing split it into 3 different strings, beginning, middle, and end and add 4000 to the middle string? Edited November 12, 2006 by darklitch Link to comment Share on other sites More sharing options...
Uten Posted November 12, 2006 Share Posted November 12, 2006 You can do as you have sugested or you could use StringRegExpReplace. I can't test this code now so you will have to experiment a little to get it right. Local $data = FilreRead(<datafile or other>) Local $regexp = "MOV(\d+)\.MPG" Local $replace = "MOV4000\1\.MPG" ;\1 is supposed to be replaced with the content of (\d+) ; You have to lookup $flags ; Not sure about the placements of the variables. Local $res = StringRegExpReplace($data, $regexp, $replace, $flags) Then you use FileMove to rename your files. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now