Solution ioa747 Posted March 1, 2023 Solution Share Posted March 1, 2023 this find all test*.txt (test1.txt , test2.txt etc) in folder @ScriptDir & "\kfc\ and its subfolder and replaced with @ScriptDir & "\NewTest.txt" here the initial name replaced with NewTest.txt #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <File.au3> _FindAllFile() ;---------------------------------------------------------------------------------------- Func _FindAllFile() Local $dir = @ScriptDir & "\kfc\" ; <------------ Local $ArraySrtfiles = _FileListToArrayRec($dir, "test*.txt", $FLTAR_FILES, $FLTAR_RECUR) If Not IsArray($ArraySrtfiles) Then ConsoleWrite($dir & " = Invalid input path" & @CRLF) Return Else For $x = 1 To $ArraySrtfiles[0] ;ConsoleWrite($dir & $ArraySrtfiles[$x]& @CRLF) _ReplaceTxt($dir & $ArraySrtfiles[$x]) Next EndIf EndFunc ;==>_FindAllFile ;---------------------------------------------------------------------------------------- Func _ReplaceTxt($TxtFile) Local $sName = "\NewTest.txt" Local $NewTxtFile = @ScriptDir & $sName ;ReplaceTxt FileCopy($NewTxtFile, $TxtFile, $FC_OVERWRITE + $FC_CREATEPATH) Local $sFolder = StringLeft($TxtFile, StringInStr($TxtFile, "\", $STR_NOCASESENSEBASIC, -1) -1) ;FileRename FileMove($TxtFile, $sFolder & $sName, $FC_OVERWRITE + $FC_CREATEPATH) EndFunc ;==>_ReplaceTxt Eazy-P 1 I know that I know nothing Link to comment Share on other sites More sharing options...
Eazy-P Posted March 1, 2023 Author Share Posted March 1, 2023 47 minutes ago, ioa747 said: this find all test*.txt (test1.txt , test2.txt etc) in folder @ScriptDir & "\kfc\ and its subfolder and replaced with @ScriptDir & "\NewTest.txt" here the initial name replaced with NewTest.txt #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <File.au3> _FindAllFile() ;---------------------------------------------------------------------------------------- Func _FindAllFile() Local $dir = @ScriptDir & "\kfc\" ; <------------ Local $ArraySrtfiles = _FileListToArrayRec($dir, "test*.txt", $FLTAR_FILES, $FLTAR_RECUR) If Not IsArray($ArraySrtfiles) Then ConsoleWrite($dir & " = Invalid input path" & @CRLF) Return Else For $x = 1 To $ArraySrtfiles[0] ;ConsoleWrite($dir & $ArraySrtfiles[$x]& @CRLF) _ReplaceTxt($dir & $ArraySrtfiles[$x]) Next EndIf EndFunc ;==>_FindAllFile ;---------------------------------------------------------------------------------------- Func _ReplaceTxt($TxtFile) Local $sName = "\NewTest.txt" Local $NewTxtFile = @ScriptDir & $sName ;ReplaceTxt FileCopy($NewTxtFile, $TxtFile, $FC_OVERWRITE + $FC_CREATEPATH) Local $sFolder = StringLeft($TxtFile, StringInStr($TxtFile, "\", $STR_NOCASESENSEBASIC, -1) -1) ;FileRename FileMove($TxtFile, $sFolder & $sName, $FC_OVERWRITE + $FC_CREATEPATH) EndFunc ;==>_ReplaceTxt Thanks this is what i was looking for! thanks alot just needed to declare the var before the functions and it worked Link to comment Share on other sites More sharing options...
ioa747 Posted March 1, 2023 Share Posted March 1, 2023 Thanks If you have any question ask I know that I know nothing Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted March 1, 2023 Share Posted March 1, 2023 (edited) Now @ioa747 😂 , your post (your solution) does almost the same like my post before. The funny thing is that we come up with different approaches and different understandings what @Eazy-P was wanting and at the end we suggest almost the same way. I like that 😀 . See you later. Best regards Sven Edited March 1, 2023 by SOLVE-SMART ioa747 1 Stay innovative! Spoiler 🌍 Au3Forums 🎲 AutoIt (en) Cheat Sheet 📊 AutoIt limits/defaults 💎 Code Katas: [...] (comming soon) 🎭 Collection of GitHub users with AutoIt projects 🐞 False-Positives 🔮 Me on GitHub 💬 Opinion about new forum sub category 📑 UDF wiki list ✂ VSCode-AutoItSnippets 📑 WebDriver FAQs 👨🏫 WebDriver Tutorial (coming soon) Link to comment Share on other sites More sharing options...
Eazy-P Posted March 2, 2023 Author Share Posted March 2, 2023 22 hours ago, ioa747 said: Thanks If you have any question ask Hi i do have a question. What does #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 do? Yout put it at the top of your script. Link to comment Share on other sites More sharing options...
ioa747 Posted March 2, 2023 Share Posted March 2, 2023 I know that I know nothing Link to comment Share on other sites More sharing options...
Developers Jos Posted March 2, 2023 Developers Share Posted March 2, 2023 This is used by AutoIt3Wrapper to add those parameters to the au3check step, so this will only do something when you have the separate SciTE4AutoIt3 installer installed. Jos 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...
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