Elephant007 Posted December 4, 2013 Share Posted December 4, 2013 So once again I'm working to develop a little something to help our field techs backup users profiles. I've run into a little snag due to my limited knowledge and I'm reaching out to you guys I need to set the attribute to some folders of the restored users data to hidden, I know how to do that the problem I'm having is that I'm trying to read two files, the first is BackedUpUsers which contains a list of the users that were backed up, the second is SetHidden which has a list of the of the folders I need hidden, What I would like to do is read from the BackedUpUsers list and maintain the username while the second part chews through the SetHidden file until it reaches the end of the file and then starts with the second user in the BackedUpUsers list... etc.. etc... E.G. BackedUsersList contains users john.smith and joe.public SetHidden has AppData, Application Data and NetHood I would like to run SetFileAttrib('c:\users\' & $BACKEDUPUSER & '\' & $SETHIDDEN', '+H') this way it will do the following c:usersjohn.smithAppData c:usersjohn.smithApplication Data c:usersjohn.smithNetHood Hope I've explained myself well enough to get a little help! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 4, 2013 Moderators Share Posted December 4, 2013 Elephant007,Just use nested loops - loop through the users but inside that, loop through the folders. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
l3ill Posted December 4, 2013 Share Posted December 4, 2013 (edited) Hi Elephant007, That does sound like fun ! I think I got it... Have a look at Melbas excellent RecFileListToArray. Can be set to only show folders. That will get all your folders into an array, from there you can loop through them with your setFileAttr function. Bill edit: was going to post a link but... see dragon santas sig Edited December 4, 2013 by billo My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Elephant007 Posted December 4, 2013 Author Share Posted December 4, 2013 Thank you both for your suggestions Melba23, this is what I ended up doing, is this what you suggested? Maybe it's a little rough, you know how I do #Include <File.au3> Local $aFile,$aInput,$bFile,$bInput $aFile='SetHidden' $bFile='BackedUpUser' _FileReadToArray($bFile, $bInput) For $b = 1 to UBound($bInput) -1 _FileReadToArray($aFile,$aInput) For $a = 1 to UBound($aInput) -1 FileSetAttrib('"\\' & @ComputerName & '\c$\users\'&$bInput[$b]&'\'&$aInput[$a]&'"','+H') Next Next Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 4, 2013 Moderators Share Posted December 4, 2013 Elephant007,Close, but just read the files once before you begin the loops: #include <File.au3> Local $aFile, $aInput, $bFile, $bInput $aFile = 'SetHidden' $bFile = 'BackedUpUser' _FileReadToArray($bFile, $bInput) _FileReadToArray($aFile, $aInput) For $b = 1 To UBound($bInput) - 1 For $a = 1 To UBound($aInput) - 1 FileSetAttrib('"\\' & @ComputerName & '\c$\users\' & $bInput[$b] & '\' & $aInput[$a] & '"', '+H') Next NextM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Elephant007 Posted December 6, 2013 Author Share Posted December 6, 2013 Thank you for your help once again Melba23! Your suggestion worked flawlessly! 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