[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
本帖最后由 idwma 于 2022-1-10 18:14 编辑
  1. Get-ChildItem “.\A”-Directory | Sort-Object { [int]($_.Name -split '\s+')[0] } | foreach-Object { [array]$a+=$_.FullName }
  2. dir .\b|?{$_.PSIsContainer}|%{if(test-path $_.fullname\ok){copy $a[$i++] $_.fullname -rec; copy $a[$i++] $_.fullname -rec}}
  3. if($a[$i] -eq $null){"分完"}
复制代码

TOP

回复 6# 5i365


    忘了ok路径字符拼接没处理
  1. test-path "$($_.fullname+'\ok')"
复制代码

TOP

回复 8# 5i365
  1. #&cls&@powershell -c "Get-Content '%~0' | Select-Object -Skip 1 | Out-String | Invoke-Expression" &pause&exit
  2. $k=2
  3. Get-ChildItem ".\A" -Directory | Sort-Object { [int]($_.Name -split '\s+')[0] } | foreach-Object { [array]$a+=$_.FullName }
  4. dir .\b|?{$_.PSIsContainer}|%{if(test-path "$($_.fullname+'\ok')"){while($j++ -le $k){move $a[$i++] $_.fullname}}
  5. if($a[$i] -eq $null){"分完"}
复制代码

TOP

回复 11# 5i365
  1. #&cls&@powershell -c "Get-Content '%~0' | Select-Object -Skip 1 | Out-String | Invoke-Expression" &pause&exit
  2. $k = 2
  3. Get-ChildItem ".\A" -Directory | Sort-Object { [int]($_.Name -split '\s+')[0] } | foreach-Object { [array]$a += $_.FullName }
  4. dir .\b | ?{ $_.PSIsContainer } | %{
  5. if (test-path "$($_.fullname + '\ok')") { while ($j++ -le $k) { move $a[$i++] $_.fullname } }
  6. $j=$null
  7. if ($a[$i] -eq $null) { "分完" }
  8. }
复制代码

TOP

回复 13# 5i365
  1. #&cls&@powershell -c "Get-Content '%~0' | Select-Object -Skip 1 | Out-String | Invoke-Expression" &pause&exit
  2. $k = 2
  3. Get-ChildItem ".\A" -Directory | Sort-Object { [int]($_.Name -split '\s+')[0] } | foreach-Object { [array]$a += $_.FullName }
  4. dir .\b | ?{ $_.PSIsContainer } | %{
  5. if (test-path "$($_.fullname + '\ok')") { while ($j++ -lt $k) { if ($a[$i] -ne $null){move $a[$i++] $_.fullname} } }
  6. $j=$null
  7. }
  8. if ($a[++$i] -eq $null) { "分完" }
复制代码

TOP

回复 16# 5i365
  1. #&cls&@powershell -c "Get-Content '%~0' | Select-Object -Skip 1 | Out-String | Invoke-Expression" &pause&exit
  2. $k = 2
  3. Get-ChildItem ".\A" -Directory | Sort-Object { [int]($_.Name -split '\s+')[0] } | foreach-Object { [array]$a += $_.FullName }
  4. dir .\b | ?{ $_.PSIsContainer } | %{
  5. if (test-path "$($_.fullname + '\ok')") { while ($j++ -lt $k) { if ($a[$i++] -ne $null){move $a[$i-1] $_.fullname} } }
  6. $j=$null
  7. }
  8. if ($a[++$i] -eq $null) { "分完" }
复制代码

TOP

回复 18# 5i365
  1. #&cls&@powershell -c "Get-Content '%~0' | Select-Object -Skip 1 | Out-String | Invoke-Expression" &pause&exit
  2. $k = 2
  3. Get-ChildItem ".\A" -Directory | Sort-Object { [int]($_.Name -split '\s+')[0] } | foreach-Object { [array]$a += $_.FullName }
  4. dir .\b | ?{ $_.PSIsContainer } | %{
  5. if ((test-path $($_.fullname + '\ok')) -and (dir $_.fullname).count -lt 1) { while ($j++ -lt $k) { if ($a[$i++] -ne $null){move $a[$i-1] $_.fullname} } }
  6. $j=$null
  7. }
  8. if ($a[++$i] -eq $null) { "分完" }
复制代码

TOP

本帖最后由 idwma 于 2022-1-11 18:17 编辑

回复 20# 5i365


    这次测了是可以的
怕不是又是powershell版本问题,2.0dir只有一个时count的数不是1
  1. #&cls&@powershell -c "Get-Content '%~0' | Select-Object -Skip 1 | Out-String | Invoke-Expression" &pause&exit
  2. $k = 2
  3. Get-ChildItem ".\A" -Directory | Sort-Object { [int]($_.Name -split '\s+')[0] } | foreach-Object { [array]$a += $_.FullName }
  4. dir .\b | ?{ $_.PSIsContainer } | %{
  5. if ((test-path $_.fullname + '\ok')) -and $(dir $_.fullname|%{$n++};$n;$n=$null) -lt 2) { while ($j++ -lt $k) { if ($a[$i++] -ne $null){move $a[$i-1] $_.fullname} } }
  6. $j=$null
  7. }
  8. if ($a[++$i] -eq $null) { "分完" }
复制代码

TOP

回复 22# 5i365
  1. #&cls&@powershell -c "Get-Content '%~0' | Select-Object -Skip 1 | Out-String | Invoke-Expression" &pause&exit
  2. $k = 2
  3. Get-ChildItem ".\A" -Directory | Sort-Object { [int]($_.Name -split '\s+')[0] } | foreach-Object { [array]$a += $_.FullName }
  4. dir .\b | ?{ $_.PSIsContainer } | %{
  5. if ((test-path $($_.fullname + '\ok')) -and $(dir $_.fullname|%{$n++};$n;$n=$null) -lt 2) { while ($j++ -lt $k) { if ($a[$i++] -ne $null){move $a[$i-1] $_.fullname} } }
  6. $j=$null
  7. }
  8. if ($a[++$i] -eq $null) { "分完" }
复制代码
1

评分人数

    • 5i365: 感谢帮忙! 细心!耐心!技术 + 1

TOP

返回列表