ffdshow Posted August 10, 2015 Share Posted August 10, 2015 I use the next code to rename rar volumes named like this:XvQG7zdAUbWju9NL6BDY.part01.rar,XvQG7zdAUbWju9NL6BDY.part02.rar...to something like this:DWhMwdmEk5Csk6ob5IUR.part01.rar, DWhMwdmEk5Csk6ob5IUR.part02.rar... Also, a md5 file present in the source folder will be renamed and I will attach another script to this one, to change filenames inside it.#Include <File.au3> #Include <Array.au3> $Source_Path = "D:\1" $Destination_Path = "D:\1\_Renamed" $Characters_To_Delete = "XvQG7zdAUbWju9NL6BDY" $Characters_To_Write = "DWhMwdmEk5Csk6ob5IUR" $FileList = _FileListToArray($Source_Path, $Characters_To_Delete & "*.*", 1) For $i = 1 To $FileList[0] $Name = StringTrimLeft($FileList[$i],20) ; trim the first 20 characters from the left side of the file name FileMove($Source_Path & "\" & $FileList[$i], $Destination_Path & "\" & $Characters_To_Write & $Name, 1) NextIt's possible to rename those files without use of StringTrimLeft command and how to?Thanks! Link to comment Share on other sites More sharing options...
JohnQSmith Posted August 10, 2015 Share Posted August 10, 2015 (edited) Take a look _PathSplit() from the File.au3 UDF.Edit: You'll have to use two iterations to first grab the RAR and then grab the PARTxx afterwards. Edited August 10, 2015 by JohnQSmith Enhanced info Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes". Link to comment Share on other sites More sharing options...
mikell Posted August 11, 2015 Share Posted August 11, 2015 (edited) You could use a regex to remove all non-dot characters up to the first dot$rar = "XvQG7zdAUbWju9NL6BDY.part01.rar" Msgbox(0,"1", StringRegExpReplace($rar, '^[^.]+', ""))But there are other String* solutions$rar = "XvQG7zdAUbWju9NL6BDY.part01.rar" $Characters_To_Delete = "XvQG7zdAUbWju9NL6BDY" Msgbox(0,"2", StringTrimLeft($rar, StringLen($Characters_To_Delete)) ) Msgbox(0,"3", StringReplace($rar, $Characters_To_Delete, "") ) Edited August 11, 2015 by mikell 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