Python实现文件的移动剪切功能


# coding: utf-8

# In[1]:


import os,shutil


# In[2]:


path1 = 'F:\\template\\hand-obj-data-pick Tool\\HandData\\depthMap\\depthGrayMap'
path2 = 'F:\\template\\hand-obj-data-pick Tool\\HandData\\depthMap\\depthRawMap'
path3 = 'F:\\template\\hand-obj-data-pick Tool\\HandData\\irMap\\irGrayMap'
path4 = 'F:\\template\\hand-obj-data-pick Tool\\HandData\\irMap\\irRawMap'


# In[3]:


dst_path2 = 'F:\\02_Porject_GR_Data\\01_Original_Data\\QD_Data_0726\\Right_hand'


# In[4]:


def move_files(src_path,dst_path):
    files = os.listdir(src_path)
    for file in files:
        file_path = os.path.join(src_path,file)
        shutil.move(file_path,dst_path)


# # 更改英文名

# In[11]:


dst_path2_2 = os.path.join(dst_path2,'Tom')


# In[12]:


os.makedirs(os.path.join(dst_path2_2,'depthMap','depthGrayMap'))
os.makedirs(os.path.join(dst_path2_2,'depthMap','depthRawMap'))
os.makedirs(os.path.join(dst_path2_2,'irMap','irGrayMap'))
os.makedirs(os.path.join(dst_path2_2,'irMap','irRawMap'))


# In[13]:


move_files(path1,os.path.join(dst_path2_2,'depthMap','depthGrayMap'))
move_files(path2,os.path.join(dst_path2_2,'depthMap','depthRawMap'))
move_files(path3,os.path.join(dst_path2_2,'irMap','irGrayMap'))
move_files(path4,os.path.join(dst_path2_2,'irMap','irRawMap'))

 

你可能感兴趣的:(Python)