import os
import shutil
def move_and_rename_videos(source_folder, destination_folder):
video_count = 1
for root, dirs, files in os.walk(source_folder):
for filename in files:
if filename.endswith('.mp4'):
source_path = os.path.join(root, filename)
new_filename = f"视频{video_count}.mp4"
destination_path = os.path.join(destination_folder, new_filename)
shutil.move(source_path, destination_path)
video_count += 1
source_folder = r'K:/其他/花/花'# 源文件夹路径
destination_folder = r'K:/1-1运营基础-/素材整理'# 目标文件夹路径
move_and_rename_videos(source_folder, destination_folder)
这段代码是一个Python脚本,用于将指定源文件夹中的所有MP4视频文件移动到目标文件夹,并将它们重命名为“视频X.mp4”的格式,其中X是视频的顺序号。