PowerShell命令或脚本指南根据数据量均匀地对目录进行排序
我正在将文件服务器从本地迁移到 Azure 文件共享/VM。
我已准备好一切并准备好移动,但我想将我的文件分成 4 个大小大致相等的批次。
**问题 **
如果我的文件服务器上有 100 个充满数据的目录,名为 Dir1 - Dir100。
什么命令可以帮助我弄清楚如下内容:
Dir_1 – Dir_30 == 数据总量的 25%
Dir_31 -- Dir_65 == 数据总量的 25%
Dir_66 – Dir_90 == 数据总量的 25%
Dir_91 – dir_100 == 数据总量的25%
这有意义吗?
我知道如何获取总数据大小或文件数量......但我无法弄清楚我想要做的事情是否可能或如何做。我一直在胡闹,但我什至没有接近。
I am in the process of moving my file server from on-prem up to an Azure file share/VM.
I've got everything in place and ready to move, but I am wanting to divide my files up and do it in 4 roughly equal sized batches.
**The Question **
If I had 100 directories on my fileserver full of data, named Dir1 - Dir100.
What command would help me figure out something like below:
Dir_1 – Dir_30 == 25% of total amount of data
Dir_31 -- Dir_65 == 25% of total amount of data
Dir_66 – Dir_90 == 25% of total amount of data
Dir_91 – Dir_100 == 25% of total amount of data
Does this make sense?
I know how to get total data size or number of files.... But I cannot figure out if what I am trying to do is possible or how to do it. I have been messing around, but I'm not even getting close.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,所以我两种方式都做了。您没有发布自己的任何内容,因此您必须适应我在这里发布的内容。
首先,创建目录列表。这里的两个分区字段只是它们所属的组。您将需要根据您的评论进行顺序分区。
现在,对于顺序分区:
您可以通过以下方式看到它的平衡程度:
最后一个分区可能非常不平衡。
另一方面,如果它需要尽可能平衡:
并且您可以看到它平衡事物的效率:
这更有可能为您提供更平等的平衡,尽管它肯定不完美。
Okay, so I did it both ways. You didn't post anything of your own, so you'll have to adapt what I have here.
First, create a list of your directories. The two Partition fields here are just going to be which group they belong to. You'll want the sequential partition based on your comment.
Now, for the sequential partitioning:
You can see how well balanced it is with this:
The last partition is likely to be pretty poorly balanced.
On the other hand, if it needs to be as balanced as possible:
And you can see how efficiently it balanced things:
This is much more likely to give you a more equal balancing, though it's certainly not perfect.