import mne
import matplotlib.pyplot as plt
import scipy.io
from scipy.signal import welch
from scipy import signal
# from alphawaves.dataset import AlphaWaves
import numpy as np
import scipy.io as sio
import os
import shutil
# os.path.join 用于拼接文件路径
# 新路径
NewFilePath_Open = 'E:\\睁眼闭眼实验数据\\open\\'
NewFilePath_Close= 'E:\\睁眼闭眼实验数据\\close\\'
# 我的文件路径
for i in range(1,16):
trail_number = str(i)
file_OpenEyes_Path = 'G:\\1-临时文件\\2022-10-12睁眼闭眼数据\\' + trail_number + '\\open\\'
file_CloseEyes_Path = 'G:\\1-临时文件\\2022-10-12睁眼闭眼数据\\' + trail_number + '\\close\\'
dirs_open = os.listdir(file_OpenEyes_Path)
dirs_close = os.listdir(file_CloseEyes_Path)
allfile_open_list = os.walk(file_OpenEyes_Path)
allfile_close_list = os.walk(file_CloseEyes_Path)
# 目标:更改文件名字,保存到另外的文件夹下
for root, dirs, files in allfile_open_list:
for name in files:
old_name = (os.path.join(root, name))
temp = 'sub'+str(i)+'.txt'
new_name = os.path.join(NewFilePath_Open,temp)
shutil.move(old_name, new_name)
for root, dirs, files in allfile_close_list:
for name in files:
old_name = (os.path.join(root, name))
temp = 'sub'+str(i)+'.txt'
new_name = os.path.join(NewFilePath_Close,temp)
shutil.move(old_name, new_name)
print(new_name)
python将文件从一个磁盘写入到另一个磁盘,并重命名
最新推荐文章于 2023-06-09 13:23:07 发布