Einzelnen Beitrag anzeigen

Benutzerbild von Sharky
Sharky

Registriert seit: 29. Mai 2002
Ort: Frankfurt
8.251 Beiträge
 
Delphi 2006 Professional
 
#1

Aus txt Datei Ordner struktur erstellen und files kopieren

  Alt 12. Jul 2012, 14:32
Hai ihr,

nach vielen, vielen Monaten muss ich mal wieder mein Delphi anwerfen und stelle fest das ich doch recht "eingerostet" bin.

Folgendes Problem:
Ich habe eine Textdatei mit diesem Aufbau (die Original ist einige tausen Zeilen lang):
Code:
0 General                  
0.1 TARGET Organisational chart                
0.1.1 blubb _Current Holding Structure 2011 1 1 document source          
0.2 Target property Data Base              
0.2.1 Verona property data base long 1 37 document source          
0.3 Target Financing Data Base              
0.3.1 External Loans as at 31.03.2011 -3 1 1 document source        
0.3.2 Loan Overview Contract_FRM 31.03.2011 1 1 document source          
0.4 Business Plan                
0.4.1 Project Verona business plan summary FINAL 1 2 document source        
0.5 Valuation reports                
0.6 Tax                  
0.7 Management Reports                
0.7.1 2008                   
0.7.1.1 Mgt_accts - SEPTEMBER 8 - EUROPE 1 12 document source        
0.7.2 2009                   
0.7.2.1 Mgt_accts - September -9 EUROPE 1 19 document source          
0.7.3 2010                   
0.7.3.1 blubb Europe Fund Report April 2010 1 73 document source        
0.7.3.2 blubb Europe Fund Report February 2010 1 94 document source        
0.7.3.3 blubb Europe Fund Report January 2010 1 73 document source        
0.7.3.4 blubb Europe Fund Report June 2010 1 77 document source        
0.7.3.5 blubb Europe Fund Report March 2010 1 80 document source        
0.7.3.6 blubb Europe Fund Report May 2010 1 74 document source        
0.7.3.7 blubb Europe Fund Report August 2010 1 75 document source        
0.7.3.8 blubb Europe Fund Report December 2010 1 75 document source        
0.7.3.9 blubb Europe Fund Report July 2010 1 76 document source        
0.7.3.10 blubb Europe Fund Report November 2010 1 76 document source        
0.7.3.11 blubb Europe Fund Report October 2010 1 73 document source        
0.7.3.12 blubb Europe Fund Report September 2010 1 84 document source        
0.7.4 2011                   
0.7.4.1 blubb Europe Fund Report January 2011 1 72 document source        
0.7.4.2 blubb Europe Fund Report February 2011 1 73 document source        
0.7.4.3 blubb Europe Fund Report March 2011 1 83 document source        
0.7.4.4 blubb Europe Fund Report April 2011 1 73 document source
Das ganze ist eine Liste mit Ordner und Dateinamen. Wenn in einer Zeile die Zeichenfolge "document source" forkommt handelt es sich um eine Datei, ansonsten um einen Ordner.
Der Dateiname ist dabei nur die Zahl am Anfang. Diese muss ich nebenbei auch noch durch die Beschreibung ersetzen.

Somit ist:
Code:
0.1 TARGET Organisational chart
ein Ordner und
Code:
0.1.1 blubb _Current Holding Structure 2011 1 1 document source
eine Datei.
Die Datei heist also 0.1.1.pdf und muss in "blubb _Current Holding Structure 2011.pdf" umbenannt werden. Das ist das kleinste Problem. Mein hauptproblem ist dies:
Alle Dateien sind ein einem Verzeichniss.
Ich muss jetzt eine Ordnerstruktur erzeugen die so aussieht:
Code:
c:\0 General\
 -c:\0 General\0.1 TARGET Organisational chart\
   -0.1.1 blubb _Current Holding Structure 2011.pdf
 -c:\0 General\0.2 Target property Data Base\
   -0.2.1 Verona property data base long.pdf
 -c:\0 General\0.3 Target Financing Data Base              
   -0.3.1 External Loans as at 31.03.2011 -3.pdf
   -0.3.2 Loan Overview Contract_FRM 31.03.2011.pdf
 -c:0 General\\0.4 Business Plan\
   -0.4.1 Project Verona business plan summary FINAL.pdf
 -c:\0 General\0.5 Valuation reports\
 -c:\0 General\0.6 Tax\
 -c:\0 General\0.7 Management Reports\
   -c:\0 General\0.7 Management Reports\0.7.1 2008\                   
     -0.7.1.1 Mgt_accts - SEPTEMBER 8 - EUROPE.pdf
   -c:\0 General\0.7 Management Reports\0.7.2 2009\
     -0.7.2.1 Mgt_accts - September -9 EUROPE.pdf
   -c:0 General\0.7 Management Reports\\0.7.3 2010\
     -0.7.3.1 blubb Europe Fund Report April 2010.pdf
     -0.7.3.2 blubb Europe Fund Report February 2010.pdf
     -0.7.3.3 blubb Europe Fund Report January 2010.pdf
   -c:\0 General\0.7 Management Reports\0.7.4 2011\
     -0.7.4.1 blubb Europe Fund Report January 2011 1 72 document source        
     -0.7.4.2 blubb Europe Fund Report February 2011.pdf
Ich stehe hie wie der Hai vor dem Gitterkäfig.
Meine Überlegung war das ganze irgendwie in ein TTreeView zu bekommen, aber schon das klappt nicht richtig.
Kann mir einer von euch durch denkanstösse und kleine Beispiele helfen?
Stephan B.
"Lasst den Gänsen ihre Füßchen"
  Mit Zitat antworten Zitat