我有一个包含以下文件名的文件夹:
00150005D201110172338427995.vpf
00150005D201110180005318058.vpf
00150013D201110180014448082.vpf
00150013D201110180022268098.vpf
00150013D201110180056118137.vpf
00150004D201110180102008142.vpf
00150004D201110180105398145.vpf
00150016D201110180115378151.vpf
00150016D201110180122168161.vpf
00150003Z201110180143308169.vpf
00150050S201110180232190009.vpf
每个文件都以9个字符串开头,该字符串是唯一标识符。我希望能够为每个文件解析这些文件夹,并基于9个字符的前缀,创建带有前缀名称的文件夹,然后将文件移至新创建的文件夹。
例:
之前:
f:\ION\2011291 Contains the following files
00150005D201110172338427995.vpf
00150005D201110180005318058.vpf
00150013D201110180014448082.vpf
00150013D201110180022268098.vpf
00150013D201110180056118137.vpf
00150004D201110180102008142.vpf
00150004D201110180105398145.vpf
00150016D201110180115378151.vpf
00150016D201110180122168161.vpf
00150003Z201110180143308169.vpf
00150050S201110180232190009.vpf
后:
F:\ION\2011291 contins only folders no files
F:\ION\2011291\00150005D contains
00150005D201110172338427995.vpf
00150005D201110180005318058.vpf
F:\ION\2011291\00150013D\ contains
00150013D201110180014448082.vpf
00150013D201110180022268098.vpf
00150013D201110180056118137.vpf
F:\ION\2011291\00150004D \contains
00150004D201110180102008142.vpf
00150004D201110180105398145.vpf
F:\ION\2011291\00150016D\ contains
00150016D201110180115378151.vpf
00150016D201110180122168161.vpf
F:\ION\2011291\00150003Z\ contains
00150003Z201110180143308169.vpf
F:\ION\2011291\00150050S
00150050S201110180232190009.vpf
参数:
- 我需要在Powershell中执行此操作
- 我将非常感谢有关如何完成此工作的指导,在这里我可以阅读甚至甚至更多有关实际脚本的指南。