Folder Operation

    1. Path.join and makedirs
# my destination folder
        self.dst = os.path.join(path, folder)
        self.task = folder
        os.makedirs(self.dst, exist_ok=True)
    1. Calculate the total files
import os 
list = os.listdir(dir) # dir is your directory path 
number_files = len(list) 
print number_files
    1. Renaming all the file names in a folder http://www.metagenomics.wiki/tools/ubuntu-linux/rename-multiple-files
      rename 's/教学AB楼_教A1层西门_20180411000000_20180411235959/XM/' *.avi
    1. View files in a folder
      ls folder_name

你可能感兴趣的:(Folder Operation)