SimJ Posted August 15, 2007 Share Posted August 15, 2007 Hello all.. I'm having a bit of trouble with the logic for this one.... And was wondering if anyone could help.I have the txt below in a file:1Title Folder1.1Folder1.1File.txt1.1.1Folder Child1.1.1file.txt1.1.1.1Folder GrandChild1.2Folder1.2file.txt1.2.1Folder Child1.2.2.1Folder GrandChild1.2.2.1file.txtI would like to use that txt file to read in line by line and build a directory structure that looks like: I manually created the above example... I'm trying to create a script that will make that structure by reading in data from a file, line by line.Any help is GREATLY appreciated! SimJ Link to comment Share on other sites More sharing options...
weaponx Posted August 15, 2007 Share Posted August 15, 2007 Here is one way to do this with some stipulations: #include #include Dim $aRecords If Not _FileReadToArray("file.txt",$aRecords) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf For $X = 1 to $aRecords[0] - 1 $PATH = StringReplace($aRecords[$X], ".", "\") DirCreate ( @ScriptDir & "\" & $PATH) Next Your text file structure would have to look like this to retain the folder names: 1 Title Folder 1 Title Folder.1 Folder 1 Title Folder.1 Folder.1 Folder Child 1 Title Folder.1 Folder.1 Folder Child.1 Folder GrandChild 1 Title Folder.2 Folder 1 Title Folder.2 Folder.1 Folder Child 1 Title Folder.2 Folder.2 Folder Child 1 Title Folder.2 Folder.2 Folder Child.1 Folder GrandChild 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