在 Linux 中将大目录拆分为较小的目录 [英] Splitting a large directory into smaller ones in Linux
本文介绍了在 Linux 中将大目录拆分为较小的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为 application_pdf
的大目录,其中包含 93k 个文件.我的用例是将目录拆分为 3 个较小的子目录(到原始大目录的不同位置),每个子目录包含大约 30k 个文件.这可以直接从命令行完成吗?谢谢!
I have a large directory named as application_pdf
which contains 93k files. My use-case is to split the directory into 3 smaller subdirectories (to a different location that the original large directory) containing around 30k files each.
Can this be done directly from the commandline.
Thanks!
推荐答案
使用 bash:
x=("path/to/dir1" "path/to/dir2" "path/to/dir3")
c=0
for f in *
do
mv "$f" "${x[c]}"
c=$(( (c+1)%3 ))
done
这篇关于在 Linux 中将大目录拆分为较小的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文