mattfaust Posted January 23, 2010 Posted January 23, 2010 How can I find what sub-directories exist in a path? I have a small backup script that works, but now I want it to only backup directories it hasnt found yet instead of all of em Thanks
JohnOne Posted January 23, 2010 Posted January 23, 2010 A quick look in the help file found this FileFindFirstFile() AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
mattfaust Posted January 23, 2010 Author Posted January 23, 2010 A quick look in the help file found thisFileFindFirstFile()yeah, I cant see how to make it return only directories
JohnOne Posted January 23, 2010 Posted January 23, 2010 You're right, but I suppose you could ignore .files AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Malkey Posted January 23, 2010 Posted January 23, 2010 This may help you. #include <Array.au3> ;An array of sub-directories not to be backed up this time. Local $aPrevBkUp[2] = ["C:\Program Files\AutoIt3\Examples\GUI", _ "C:\Program Files\AutoIt3\Examples\GUI\Advanced"] ;List of all sub-directories Local $sSortedDir = StringStripWS(_GetDOSOutput('dir "C:\Program Files\AutoIt3\" /A:-A /S /B /O:N'), 3) ;ConsoleWrite(_GetDOSOutput('dir /?') & @CRLF) ; Dir help ConsoleWrite($sSortedDir & @CRLF) ;Remove sub-directories not requiring backup For $i = 0 To UBound($aPrevBkUp) - 1 If StringInStr($sSortedDir, $aPrevBkUp[$i]) <> 0 Then $sSortedDir = StringReplace($sSortedDir, $aPrevBkUp[$i] & @CRLF, "") Next ;Change string of sub-directories into an array of sub-directories. Local $aNewBkUpDirs = StringSplit($sSortedDir, @CRLF, 3) _ArrayDisplay($aNewBkUpDirs) ; http://www.autoitscript.com/forum/index.php?showtopic=108678&view=findpost&p=765520 ; http://www.autoitscript.com/forum/index.php?showtopic=106254&view=findpost&p=750640 Func _GetDOSOutput($command) Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, 2 + 4) While 1 $text &= StdoutRead($Pid, False, False) If @error Then ExitLoop Sleep(10) WEnd Return $text EndFunc ;==>_GetDOSOutput
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