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 write a regular expression to validate GUID (Globally Unique IDentifier) or UUID (Universally...
All credit card numbers issued by JCB have 3 sets of numbers: JCB cards start with 2131 have 15 digi...
All credit card numbers issued by Diners Club must start with 300 through 305, 36 or 38 and have 14 ...
According to the IEEE 802 specification, a MAC address has 6 groups of 2 hexadecimal digits separate...
All credit card numbers issued by Diners Club must start with 300 through 305, 36 or 38 and have 14 ...