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:
How to capture the Sogou web spider entries from Web log file? Here are some Web log file entries: 1...
A free online regular expression test tool that allows to try you regular expression pattern and see...
How to capture the MSN (Microsoft Network) bot entries from Web log file? Here are some Web log file...
All credit card numbers issued by JCB have 3 sets of numbers: JCB cards start with 2131 have 15 digi...
How to capture the Baidu spider entries from Web log file? Here are some Web log file entries: 127.0...