将一个目录中多个不知名的文件移动另一个目录中

#!/bin/bash

# 源文件夹和目标文件夹
source_dir="/path/to/source_folder"
destination_dir="/path/to/destination_folder"

# 指定要移动的文件数量
files_to_move=5000

# 使用find命令查找并移动文件
find "$source_dir" -type f | head -n $files_to_move | xargs -I {} mv {} "$destination_dir"

echo "Moved $files_to_move files from $source_dir to $destination_dir"

 

posted @ 2023-11-03 15:44  Leonardo-li  阅读(4)  评论(0编辑  收藏  举报