【发布时间】:2013-11-25 04:13:40
【问题描述】:
只是想知道是否可以让脚本根据字母表将电影文件移动到特定文件夹?
例如 Scream 4 将被移动到 e:\movies\s\ Avatar 将被移动到 e:\movies\a\
我启动了一个如下所示的脚本: 但是结果并不好!脚本尝试用文件名创建目录...
$a = new-object -comobject wscript.shell
$b = Get-Location
foreach($file in (dir $b -file -recurse)) {
New-Item -Path $b -Name (Split-Path $file.fullname -Leaf).Replace($file.extension,"") -ItemType Directory -Confirm
Move-Item -Path $file.fullname -Destination "$b\$((Split-Path $file.fullname -Leaf).Replace($file.Extension,''))" -Confirm
}
一个想法? 非常感谢! 克雷格
【问题讨论】:
标签: powershell