回答編集履歴
1
Python追記
answer
CHANGED
@@ -9,4 +9,18 @@
|
|
9
9
|
after = "./NEW_TEXT/#{$~[1]}#{$~[2]}.txt"
|
10
10
|
FileUtils.mv f, after
|
11
11
|
end
|
12
|
+
```
|
13
|
+
---
|
14
|
+
Pythonでも行けました。
|
15
|
+
|
16
|
+
```Python
|
17
|
+
import re
|
18
|
+
import glob
|
19
|
+
import shutil
|
20
|
+
|
21
|
+
files = glob.glob("./TEXT*/*/*.txt")
|
22
|
+
for f in files:
|
23
|
+
m = re.match(r"./TEXT.*?/(.*?)/(.*).txt", f)
|
24
|
+
after = "./NEW_TEXT/{0}{1}.txt".format(m.group(1), m.group(2))
|
25
|
+
shutil.copy(f, after)
|
12
26
|
```
|