vbscript - Search Keyword and rename entire file using VBS -


i spent quite bit looking around. did find 1 method extremely close looking replaces keywords.

dim sname dim fso dim fol  ' create filesystem object  set fso = wscript.createobject("scripting.filesystemobject")    ' current folder   set fol = fso.getfolder("f:\downloads")     ' go thru each files in folder    each fil in fol.files  ' check if file name contains underscore if instr(1, fil.name, "[wizardry] tv show bob - 13") <> 0 ' replace underscore space sname = replace(fil.name, "[wizardry] tv show bob - 13", "tv show bob s03e13") ' rename file fil.name = sname end if next   ' echo job completed  wscript.echo "completed!" 

but said, issue repalces keywords. want replace entire file name want.

most of files have group tag before hand this: [wizardy] tv show bob - 13

i want make sure group tag gone can copy file over. unless there way pull file name of current file renamed.

any appreciated, thanks.

instead of replace, need generate new name original extension, think? if not, please give more detail.

dim sname dim fso dim fol dim fil dim ext  set fso = wscript.createobject("scripting.filesystemobject") set fol = fso.getfolder("f:\downloads")  each fil in fol.files     'may need specify comparison     if instr(1, fil.name, "[wizardry] tv show bob - 13", vbtextcompare) <> 0         ext = fso.getextensionname(fil)         if len(ext) > 0 ext = "." & ext         sname = "tv show bob s03e13" & ext         fil.name = sname     end if next  wscript.echo "completed!" 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -