Other Resources:
Parsing Windows TREE Command Output
Regex for parse output of Windows TREE command. For example:
Folder PATH listing Volume serial number is 8704-028C C: +---BIOS | \---E0CN23WW | E0CN23WW.exe | +---driveri | 0rww03af.exe | 2tl502af.exe | 2tl602af.exe | 365.10-notebook-win10-64bit-international-whql (1).exe | bob501af.exe | e0cn23ww_ia32.exe | +---drivers | +---Bluetooth Driver | | | 0x0402.ini | | | 0x0403.ini | | | | | +---BT_Driver | | | \---Win10X64 | | | bthvirtual.cat | | | bthvirtual.inf | | | rtka2dp.cat | | | RtkA2dp.inf | | | RtkHfp.sys | | | | | \---Release notes | | readme.txt | | Release_RTKBluetoothE.txt | | | +---Camera Driver (Gennis, Realtek) | | | DeDrvLdr.ini | | | Install.exe | | | | | +---10.0.10120.11122 | | | | data1.cab | | | | data1.hdr | | | | data2.cab And so on ...
I need way to create folder and file structure from output like that.
✍: Excrucio
Hi Excrucio, You can try the following logic:
1. Loop through the output one line at a time 2. Use ^.*[+\]---(.*)$ to match for a folder name 3. Do what needed for the folder 3. Use ^(?!.*[+\]---).*\| +(.+)$ to match for a file name 4. Do whatever needed for the file
2016-06-23, 0👍, 0💬
Popular Posts:
All credit card numbers issued by Diners Club must start with 300 through 305, 36 or 38 and have 14 ...
How to capture the Sogou web spider entries from Web log file? Here are some Web log file entries: 1...
How to capture the Soso Spider entries from Web log file? Here are some Web log file entries: 127.0....
How to capture the MSN (Microsoft Network) bot entries from Web log file? Here are some Web log file...
How to write a regular expression to parse key-value entries from Windows .INI files? Here is an exa...