knotten2 Posted December 21, 2006 Share Posted December 21, 2006 It only works when script is present in the current directory. I want to remove "Html" from the file name in the directory of "C:\Downloads\tull".... The script can be runed from anywhere,but the files that I want to change is always in "C:\Downloads\tull".... Help anyone Dim $Plass = 'C:\Downloads\tull\' $search = FileFindFirstFile ($Plass & '*.*') ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop $filenew = $file $fileNew = StringReplace($fileNew,".html","") If $file <> $filenew then FileMove($file,$filenew) WEnd ; Close the search handle FileClose($search) Link to comment Share on other sites More sharing options...
Developers Jos Posted December 21, 2006 Developers Share Posted December 21, 2006 It only works when script is present in the current directory. I want to remove "Html" from the file name in the directory of "C:\Downloads\tull".... The script can be runed from anywhere,but the files that I want to change is always in "C:\Downloads\tull".... Help anyone Dim $Plass = 'C:\Downloads\tull\' $search = FileFindFirstFile ($Plass & '*.*') ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop $filenew = $file $fileNew = StringReplace($fileNew,".html","") If $file <> $filenew then FileMove($file,$filenew) WEnd ; Close the search handle FileClose($search) If $file <> $filenew then FileMove($Plass & "\" & $file,$Plass & "\" & $filenew) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
knotten2 Posted December 21, 2006 Author Share Posted December 21, 2006 If $file <> $filenew then FileMove($Plass & "\" & $file,$Plass & "\" & $filenew)Thanks...I can see it now.... 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