jeantje Posted March 15, 2010 Share Posted March 15, 2010 Hi guys i have a little problem, I need to create an exact file / folders structure with empty files from this list. De volumenaam van station C is OS Het volumenummer is BA4B-049E Map van C:\ 03-02-2010 14:30 <DIR> dell 24-12-2009 21:46 <DIR> Drivers 31-01-2010 01:18 <DIR> Intel 02-12-2006 06:37 904.704 msdia80.dll 14-07-2009 04:20 <DIR> PerfLogs 25-02-2010 12:55 <DIR> Program Files 25-02-2010 12:57 <DIR> Program Files (x86) 24-02-2010 11:35 <DIR> Temp1234 05-02-2010 13:04 <DIR> Users 24-02-2010 11:07 <DIR> Windows 1 bestand(en) 904.704 bytes Map van C:\dell 03-02-2010 14:30 <DIR> . 03-02-2010 14:30 <DIR> .. 31-01-2010 02:54 <DIR> CAE 31-01-2010 03:53 416 DBRM.ini 31-01-2010 01:25 66 dell.cae 31-01-2010 02:54 <DIR> DownloadStore 31-01-2010 02:54 29.936 dscstart64.exe 3 bestand(en) 30.418 bytes Any idea's I have not. I tried it with StringRegExp, but no succes Link to comment Share on other sites More sharing options...
funkey Posted March 15, 2010 Share Posted March 15, 2010 Maybe it is easier when you use 'dir /w' to create the list. Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 15, 2010 Moderators Share Posted March 15, 2010 jeantje, This should do what you want: expandcollapse popup#include <Array.au3> #include <File.au3> Global $aList _FileReadToArray("Dir.txt", $aList) For $i = 1 To $aList[0] $sLine = $aList[$i] $iIndex = StringInStr($sLine, "Map van") If $iIndex <> 0 Then $sPath = StringMid($sLine, $iIndex + 8) If StringRight($sPath, 1) <> "\" Then $sPath &= "\" $i = _Level($i + 2) EndIf Next Func _Level($iStart) For $j = $iStart To $aList[0] $sLine = $aList[$j] If StringLeft($sLine, 1) = " " Then ExitLoop $sName = StringMid($sLine, 37) If StringinStr($sLine, "<DIR>") <> 0 Then Switch $sName Case ".", ".." ; Ignore Case Else ;ConsoleWrite("Folder: " & $sPath & $sName & @CRLF) DirCreate($sPath & $sName) EndSwitch Else ;ConsoleWrite("File: " & $sPath & $sName & @CRLF) FileWrite($sPath & $sName, "") EndIf Next Return $j EndFunc I put your data into a file and then read it into an array - you may wish to do it another way. 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...
jeantje Posted March 15, 2010 Author Share Posted March 15, 2010 Thank you now I can revive the files on my dead hdd 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