RBrown1375 Posted April 10, 2012 Posted April 10, 2012 (edited) I had everything ready to go and now I learn my PST script needs to over-look a PST file that always has the same name, but is on a number of different servers. I looked in the help section but I could not find any command to over-look, exclude, ignore ect. the file. My script is below and works great: ;Local $sUserName = "Administrator" ;Local $sPassword = "SomePassword" ;RunAs($sUserName, @ComputerName, $sPassword, 0, @SystemDir) #include <Array.au3> #include "RecFileListToArray.au3" PST() Func PST() Local $aArray, $aDrives = DriveGetDrive("FIXED") ; Read the Help file about DriveGetDrive. If @error = 0 Then For $i = 1 To $aDrives[0] $aArray = _RecFileListToArray($aDrives[$i] & "", "*.pst", 1, 1, 0, 2) If @error Then ContinueLoop EndIf For $j = 1 To $aArray[0] ;ConsoleWrite("FileDelete(" & $aArray[$j] & ")" & @CRLF) FileDelete($aArray[$j]) Next Next EndIf EndFunc ;==>PST If every server has a PST called "Batman.PST", how can I exclude that file and still remove the others? Edited April 11, 2012 by RBrown1375
WhiteSpace Posted April 10, 2012 Posted April 10, 2012 I'm not sure if this will help exactly the way you are looking for but after your array is built you can use _ArraySearch to find any Batman.PST instances and _ArrayDelete the index.
Moderators Melba23 Posted April 10, 2012 Moderators Posted April 10, 2012 RBrown1375,You should have posted in the RecFileListToArray thread, but now that you are here...Just use the $sExclude_List parameter like this: $aArray = _RecFileListToArray($aDrives[$i] & "", "*.pst", 1, 1, 0, 2, "Batman.PST")Or you could just ignore those files when you delete: For $j = 1 To $aArray[0] If $aArray[$j] <> "Batman.PST Then FileDelete($aArray[$j]) EndIf NextAll clear? 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
RBrown1375 Posted April 11, 2012 Author Posted April 11, 2012 (edited) I'll give this a try to both posts. Thank you! Melba23, The first solution you offered works fine, but I'm curious to know if there is a way to add another excluded file to that line? example: $aArray = _RecFileListToArray($aDrives[$i] & "", "*.pst", 1, 1, 0, 2, "SomeName.PST" "SomeOtherName.PST") I'm just covering my bases..... Cheers Edited April 11, 2012 by RBrown1375
Moderators Melba23 Posted April 11, 2012 Moderators Posted April 11, 2012 RBrown1375, The first solution you offered works fineAs I wrote the UDF I should hope so! but I'm curious to know if there is a way to add another excluded file to that line?At times you wonder why you bother to write function headers explaining what the parameters mean.... You just need to separate the different masks with a semi-colon: $sExclude_List - Optional: filter for excluded results (default ""). Multiple filters must be separated by ";" All clear now? 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
RBrown1375 Posted April 11, 2012 Author Posted April 11, 2012 I did read the headers and tried to write my code based on yours, but mine fails on the ";". $aArray = _RecFileListToArray($aDrives[$i] & "", "*.pst", 1, 1, 0, 2, "SomeName.PST" )If I run this example above, my script will protect the underlined file, but no others when I add code variations or the ";". I'll keep at it.Thanks
Moderators Melba23 Posted April 11, 2012 Moderators Posted April 11, 2012 RBrown1375, The line should look like this: $aArray = _RecFileListToArray($aDrives[$i] & "", "*.pst", 1, 1, 0, 2, "SomeName.PST;SomeOtherName.PST") I have just tested it and it really does work. 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
RBrown1375 Posted April 11, 2012 Author Posted April 11, 2012 Yeah its works when you remember to Sellp, Slpel, Spell correctly! Sorry... Thank you for your time!
Moderators Melba23 Posted April 11, 2012 Moderators Posted April 11, 2012 RBrown1375, Been there, done that! No problem. 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
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