-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathtest111.py
More file actions
26 lines (22 loc) · 785 Bytes
/
Copy pathtest111.py
File metadata and controls
26 lines (22 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File : test111.py
@Modify Time @Author @Version @Description
------------ ------- -------- -----------
2021/7/1 16:56 SeafyLiang 1.0 None
"""
import os
for dirpath, dirnames, filenames in os.walk(
r'/Users/seafyliang/DEV/FaceDetect'):
# print(f'打开文件夹{dirpath}') # 当前文件夹路径
os.chdir("/Users/seafyliang/DEV/FaceDetect")
if dirnames:
print(dirnames) # 包含文件夹名称[列表形式]
if filenames:
for i in filenames:
print(i) # 包含文件名称[列表形式]
dirname = str(i).split('.')[0]
os.mkdir(dirname)
os.system('mv %s %s ' % (i, dirname))
print('-' * 10)