This paper is finally updated at 1175 Days ago, , The information may have developed or changed .
import os
path = 'C:\Users\Yuyy\Desktop\ShortVideo' # Directory to traverse
for root, dirs, names in os.walk(path):
for name in names:
ext = os.path.splitext(name)[1] # Get suffix
if ext == '.mp4':
fromdir = os.path.join(root, name) # mp4 Original address of document
moveto = os.path.join("C:\Users\Yuyy\Desktop\Video", name)
#dirname Previous Directory
os.rename(fromdir, moveto) # Moving files
Post Views: 324