GuillaumeN Posted July 24, 2022 Share Posted July 24, 2022 Hi everyone, I'm novice with AutoIT. I am creating a script that copy 2 files in a Firefox folder (%APPDATA%\Mozilla\Firefox\Profiles\FOLDER), but name of this FOLDER change depending of the computeur. (For exemple: geudzg.defaut ou ytrrzedze.defaut...) My script looks like that: FileCopy(@ScriptDir & "\profile\places.sqlite", @AppDataDir& "\Mozilla\Firefox\Profiles\*.defaut",$FC_OVERWRITE) FileCopy(@ScriptDir & "\profile\prefs.js", @AppDataDir& "\Mozilla\Firefox\Profiles\*.defaut",$FC_OVERWRITE) I would like to ask to my script to copy the 2 files in this FOLDER regardless of his name. It should be better if i could copy these 2 files un all the subdirectories of "Profiles" whithever folder names. Thank you very much for you help, and sorry if my English is clumsy. Link to comment Share on other sites More sharing options...
Subz Posted July 24, 2022 Share Posted July 24, 2022 (edited) Something like this maybe? #include <File.au3> Global $g_aProfiles = _FileListToArrayRec(@AppDataDir & "\Mozilla\Firefox\Profiles", "*.default", 2, 0, 0, 2) If @error Then MsgBox(4096, "Error", "No Profile Directories found") For $i = 1 To $g_aProfiles[0] FileCopy(@ScriptDir & "\profile\places.sqllite", $g_aProfiles[$i], 1) FileCopy(@ScriptDir & "\profile\prefs.js", $g_aProfiles[$i], 1) Next Edited July 24, 2022 by Subz Link to comment Share on other sites More sharing options...
Solution GuillaumeN Posted July 24, 2022 Author Solution Share Posted July 24, 2022 25 minutes ago, Subz said: Something like this maybe? #include <File.au3> Global $g_aProfiles = _FileListToArrayRec(@AppDataDir & "\Mozilla\Firefox\Profiles", "*.default", 2, 0, 0, 2) If @error Then MsgBox(4096, "Error", "No Profile Directories found") For $i = 1 To $g_aProfiles[0] FileCopy(@ScriptDir & "\profile\places.sqllite", $g_aProfiles[$i], 1) FileCopy(@ScriptDir & "\profile\prefs.js", $g_aProfiles[$i], 1) Next Thank you Subz for your Help, I tried your code and have 2 errors: Link to comment Share on other sites More sharing options...
GuillaumeN Posted July 24, 2022 Author Share Posted July 24, 2022 Sorry, It's good! I replaced "default" by "defaut" (in french) Great solution!!! Thank you 1000 times!!! Link to comment Share on other sites More sharing options...
Subz Posted July 24, 2022 Share Posted July 24, 2022 Sorry it should have been: If @error Then Exit MsgBox(4096, "Error", "No Profile Directories found") 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