基于文本和数字的分层文件夹系统



我正在尝试制作一个基于Hornbostel-Sachs系统(乐器的分层系统)的文件夹分层系统。到目前为止,我已经设法调出了一个互联网列表。

现在我需要把这个列表分成文件夹和子文件夹。第一个问题是,我还没有完全弄清楚如何使一个文件夹与多个子文件夹。

我不指望任何人替我做这项工作。但一些帮助如何接近这将是非常感激!

1   IDIOPHONES
11   Struck idiophones
111   Idiophones struck directly
111.1   Concussion idiophones or clappers
111.11   Concussion sticks or stick clappers
111.12   Concussion plaques or plaque clappers
111.13   Concussion troughs or trough clappers
111.14   Concussion vessels or vessel clappers
111.141   Castanets
111.142   Cymbals
111.2   Percussion idiophones
111.21   Percussion sticks
111.211   (Individual) percussion sticks
111.212   Sets of percussion sticks
111.22   Percussion plaques
111.221   (Individual) percussion plaques
111.222   Sets of percussion plaques
111.23   Percussion tubes
111.231   Individual percussion tubes
111.232   Sets of percussion tubes
111.24   Percussion vessels
111.241   Gongs
111.241.1   (Individual) gongs
111.241.2   Sets of gongs [gong chimes]
111.242   Bells
111.242.1   (Individual) bells
111.242.11   Resting bells
111.242.12   Suspended bells
111.242.121   Suspended bells struck from the outside
111.242.122   Clapper bells
111.242.2   Sets of bells [chimes] (subdivided as 111.242.1)
112   Indirectly struck idiophones
112.1   Shaken idiophones or rattles
112.11   Suspension rattles
112.111   Strung rattles
112.112   Stick rattles
112.12   Frame rattles
112.121   Pendant rattles
112.122   Sliding rattles
112.13   Vessel rattles
112.2   Scraped idiophones
112.21   Scraped sticks
112.211   Scraped sticks without resonator
112.212   Scraped sticks with resonator
112.22   Scraped tubes
112.23   Scraped vessels
112.24   Scraped wheels or cog rattles
112.3   Split idiophones
12   Plucked idiophones
121   In the form of a frame
121.1   Clack idiophones (cricri)
121.2   Guimbardes (Jews' harps)
121.21   Idioglot guimbardes
121.22   Heteroglot guimbardes
121.221   (Single) heteroglot guimbardes
121.222   Sets of heteroglot guimbardes
122   In board- or comb-form
122.1   With laced-on lamellae
122.11   Without resonator
122.12   With resonator
122.2   With cut-out lamellae (musical boxes)
13   Friction idiophones
131   Friction sticks
131.2   Sets of friction sticks
131.21   Without direct friction
131.22   With indirect friction
132   Friction plaques
132.1   (Individual) frinction plaques
132.2   Sets of friction plaques [livika]
133   Friction vessels
133.1   (Individual) friction vessels
133.2   Sets of friction vessels
14   Blown idiophones
141   Blown sticks
141.1   (Individual) blown sticks
141.2   Sets of blown sticks
142.1   (Individual) blown plaques
142.2   Sets of blown plaques
2   MEMBRANOPHONES
21   Struck drums
211   Drums struck directly
211.1   Kettle drums (timpani)
211.11   (Separate) kettle drums
211.12   Sets of kettle drums
211.2   Tubular drums
211.21   Cylindrical drums
211.211   Single-skin cylindrical drums
211.211.1   Open cylindrical drums
211.211.2   Closed cylindrical drums
211.212   Double-skin cylindrical drums
211.212.1   (Individual) cylindrical drums
211.212.2   Sets of cylindrical drums
211.22   Barrel-shaped drums (to be subdivided like 211.21)
211.23   Double-conical drums
211.24   Hourglass-shaped drum (to be subdivided like 211.21)
211.25   Conical drums (to be subdivided like 211.21)
211.26   Goblet-shaped drums (to be subdivided like 211.21)
211.3   Frame drums
211.31   Frame drums (without handle)
211.311   Single-skin frame drums
211.312   Double-skin frame drums
211.32   Frame drum with handle
211.321   Single-skin frame drums with handle
211.322   Double-skin frame drums with handle
212   Rattle drums (sub-divisions as for drums struck directly, 211)
22   Plucked drums
23   Friction drums
231   Friction drums with stick
231.1   With inserted stick
231.11   Friction drums with fixed stick
231.12   Friction drums with semi-fixed stick
231.13   Friction drums with free stick
231.2   With tied stick
232   Friction drum with cord
232.1   Stationary friction drum with cord
232.11   Single-skin stationary drums with friction-cord
232.12   Double-skin stationary drums with friction-cord
232.2   Friction drum with whirling stick
233   Hand friction drums
24   Singing membranes (Kazoos)
241   Free kazoos
242   Tube- or vessel-kazoos
3   CHORDOPHONES
31   Simple chordophones or zithers
311   Bar zithers
311.1   Musical bows
311.11   Idiochord musical bows
311.111   Mono-idiochord musical bows
311.112   Poly-idiochord musical bows or harp-bows
311.12   Heterochord musical bows
311.121   Mono-heterochord musical bows
311.121.1   Without resonator
311.121.11   Without tuning noose
311.121.12   With tuning noose
311.121.2   With resonator
311.121.21   With independent resonator
311.121.22   With resonator attached
311.121.221   Without tuning noose
311.121.222   With tuning noose
311.122   Poly-heterochord musical bows
311.122.1   Without tuning noose
311.122.2   With tuning noose
311.2   Stick zithers
311.21   Musical bow cum stick
311.22   (True) stick zithers
311.221   With one resonator gourd
311.222   With several resonator gourds
312   Tube zithers
312.1   Whole-tube zithers
312.11   Idiochord (true) tube zithers
312.12   Heterochord (true) tube zithers
312.121   Without extra resonator
312.122   With extra resonator
312.2   Half-tube zithers
312.21   Idiochord half-tube zithers
312.22   Heterochord half-tube zithers
313   Raft zithers
313.1   Idiochord raft zithers
313.2   Heterochord raft zithers
314   Board zithers
314.1   True board zithers
314.11   Without resonator
314.12   With resonator
314.121   With resonator bowl
314.122   With resonator box (box zither)
314.2   Board zither variations
314.21   Ground zithers
314.22   Harp zithers
315   Trough zithers
315.1   Without resonator
315.2   With resonator
316   Frame zithers
316.1   Without resonator
316.2   With resonator
32   Composite chordophones
321   Lutes
321.1   Bow lutes [pluriarc]
321.2   Yoke lutes or lyres
321.21   Bowl lyres
321.22   Box lyres
321.3   Handle lutes
321.31   Spike lutes
321.311   Spike bowl lutes
321.312   Spike box lutes or spike guitars
321.313   Spike tube lutes
321.32   Necked lutes
321.321   Necked bowl lutes
321.322   Necked box lutes or necked guitars
322   Harps
322.1   Open harps
322.11   Arched harps
322.12   Angular harps
322.2   Frame harps
322.21   Without tuning action
322.211   Diatonic frame harps
322.212   Chromatic frame harps
322.212.1   With the strings in one plane
322.212.2   With the strings in two planes crossing one another
322.22   With tuning action
322.221   With manual action
322.222   With pedal action
323   Harp lutes
4   AEROPHONES
41   Free aerophones
411   Displacement free aerophones
412   Interruptive free aerophones
412.1   Idiophonic interruptive aerophones or reeds
412.11   Concussion reeds
412.12   Percussion reeds
412.121   Individual percussion reeds
412.122   Sets of percussion reeds
412.13   Free reeds
412.131   (Individual) free reeds
412.132   Sets of free reeds
412.14   Ribbon reeds
412.2   Non-idiophonic interruptive instruments
412.21   Rotating aerophones
412.22   Whirling aerophones
413   Plosive aerophones
42   Wind instruments proper
421   Edge instruments or flutes
421.1   Flutes without duct
421.11   End-blown flutes
421.111   (Single) end-blown flutes
421.111.1   Open single end-blown flutes
421.111.11   Without fingerholes
421.111.12   With fingerholes
421.111.2   Stopped single end-blown flutes
421.111.21   Without fingerholes
421.111.22   With fingerholes
421.112   Sets of end-blown flutes or panpipes
421.112.1   Open panpipes
421.112.11   Open (raft) panpipes
421.112.12   Open bundle (pan-) pipes
421.112.2   Stopped panpipes
421.112.3   Mixed open and stopped panpipes
421.12   Side-blown flutes
421.121   (Single) side-blown flutes
421.121.1   Open side-blown flutes
421.121.11   Without fingerholes
421.121.12   With fingerholes
421.121.2   Partly-stopped side-blown flutes
421.121.3   Stopped side-blown flutes
421.121.31   Without fingerholes
421.121.311   With fixed stopped lower end
421.121.312   With adjustable stopped lower end (piston flutes)
421.121.32   With fingerholes
421.122   Sets of side-blown flutes
421.122.1   Sets of open slide-blown flutes
421.122.2   Sets of stopped side-blown flutes
421.13   Vessel flutes (without distinct beak)
421.2   Flutes with duct or duct flutes
421.21   Flutes with external duct
421.211   (Single) flutes with external duct
421.211.1   Open flutes with external duct
421.211.11   Without fingerholes
421.211.12   With fingerholes
421.211.2   Partly-stopped flutes with external duct
421.211.3   Stopped flutes with external duct
421.212   Sets of flute with external duct
421.22   Flutes with internal duct
421.221   (Single) flutes with internal duct
421.221.1   Open flutes with internal duct
421.221.11   Without fingerholes
421.221.12   With fingerholes
421.221.2   Partly-stopped flute with internal duct
421.221.3   Stopped flutes with internal duct
421.221.31   Without fingerholes
421.221.311   With fixed stopped lower end
421.221.312   With adjustable stopped lower end
421.221.4   Vessel flutes with duct
421.221.41   Without fingerholes
421.221.42   With fingerholes
421.222   Sets of flutes with internal duct
421.222.1   Sets of open flutes with internal duct
421.222.11   Without fingerholes
421.222.12   With fingerholes
421.222.2   Sets of partly-stopped flutes with internal duct
421.222.3   Sets of stopped flutes with internal duct
422   Reedpipes
422.1   Oboes
422.11   (Single) oboes
422.111   With cylindrical bore
422.111.1   Without fingerholes
422.111.2   With fingerholes
422.112   With conical bore
422.12   Sets of oboes
422.121   With cylindrical bore
422.122   With conical bore
422.2   Clarinets
422.21   (Single) clarinets
422.211   With cylindrical bore
422.211.1   Without fingerholes
422.211.2   With fingerholes
422.212   With conical bore
422.22   Sets of clarinets
422.3   Reedpipes with free reeds
422.31   Single pipes with free reed
422.32   Double pipes with free reeds
423   Trumpets
423.1   Natural trumpets
423.11   Conches
423.111   End-blown
423.111.1   Without mouthpiece
423.111.2   With mouthpiece
423.112   Side-blown
423.12   Tubular trumpets
423.121   End-blown trumpets
423.121.1   End-blown straight trumpets
423.121.11   Without mouthpiece
423.121.12   With mouthpiece
423.121.2   End-blown horns
423.121.21   Without mouthpiece
423.121.22   With mouthpiece

我不想在文件夹名称中使用实际数字。我把它们包括进来只是为了说明等级制度。如果有帮助,我正在使用目录Opus(专业版)。如果没有,我会很高兴地使用任何其他软件来实现相同的目标。没问题。

这个问题特别复杂和有趣。我喜欢! :)

@echo off
setlocal EnableDelayedExpansion
set prevLevel=-1
for /F "tokens=1*" %%a in (test.txt) do (
   set "hierarchy=%%a"
   set "hierarchy=!hierarchy:.=!"
   set /A thisLevel=prevLevel+1
   for /F "tokens=1,2" %%i in ("!prevLevel! !thisLevel!") do (
      if "!hierarchy:~%%j,1!" neq "" (
         rem Level forward: create child directory and enter to it
         md "%%b"
         cd "%%b"
         set /A prevLevel+=1
      ) else if "!hierarchy:~%%i,1!" neq "" (
         rem Same level: create brother directory and enter to it
         cd ..
         md "%%b"
         cd "%%b"
      ) else (
         rem Level backward: first go back to corresponding parent directory
         for /L %%n in (%%i,-1,0) do (
            if "!hierarchy:~%%n,1!" equ "" (
               cd ..
               set prevLevel=%%n
            )
         )
         cd ..
         set /A prevLevel-=1
         rem Then create the directory at this place and enter to it
         md "%%b"
         cd "%%b"
      )
   )
)

我建议你用层次树的一小部分来测试这个程序;我不确定这种方法在某些情况下是否会失败。

请注意,如果数字不包括在文件夹名称中,则创建树的顺序将按字母顺序排列;在某些情况下,这可能导致元素的顺序不同。例如,这一节:

111.11   Concussion sticks or stick clappers
111.12   Concussion plaques or plaque clappers
111.13   Concussion troughs or trough clappers
111.14   Concussion vessels or vessel clappers

将按以下顺序排列:

Concussion plaques or plaque clappers
Concussion sticks or stick clappers
Concussion troughs or trough clappers
Concussion vessels or vessel clappers
但是,这只适用于元素的display;子文件夹总是在右父文件夹中创建。

关于创建包含多层文件夹的目录,Windows允许您在一个命令中创建整个树,例如:

md "IDIOPHONESStruck idiophonesIdiophones struck directlyConcussion vessels or vessel clappersCastanets"

最新更新