zoukankan      html  css  js  c++  java
  • [Admin]CCTV文件分类

    #建立远程服务器的文件夹映射 
    $pw = ConvertTo-SecureString '密码' -AsPlainText -Force 
    $Creds = New-Object -Typename System.Management.Automation.PSCredential -Argumentlist "cnhzsrv11ultraman", $pw 
    $target = New-PSDrive -Name P -PSProvider FileSystem -Root '\cnhzsrv11D$cctvtest' -Credential $Creds 
    #定义所有通道名称 
    $B9F10Channels = "1_8楼入口","2_8楼后门","3_8楼机房","4_1楼UPS后","5_9楼入口","6_9楼后门","7_9楼机房","8_1楼UPS前","9_CISCO后门","10_CISCO前门","13_10楼入口","14_10楼后门","15_10楼机房前","16_10楼机房后" 
    $B8F1Channels = "1_1楼入口","2_1楼后门","4_1楼机房后","5_1楼机房前","7_1楼UPS" 
    $B8F2Channels = "1_电话机房","2_IFF机房","3_OC机房","4_2楼入口","5_2楼后门","6_Cisco机房","7_Cigna机房","8_Prj 5 机房","9_Cisco入口" 
    #10楼 
    Set-Location -Path P:B9F10 
    $B9F10datefolders = (Get-ChildItem).FullName 
    foreach($B9F10datefolder in $B9F10datefolders) { 
    Set-Location -Path $B9F10datefolder 
    foreach($B9F10Channel in $B9F10Channels) { 
    New-Item $B9F10Channel -ItemType directory -Force 
    } 
    Get-ChildItem | where-object mode -EQ '-a---' | foreach { 
    switch($_.name) { 
    {$_ -like '*_1.*'} {Move-Item -Path $_ -Destination '.1_8楼入口'} 
    {$_ -like '*_2.*'} {Move-Item -Path $_ -Destination '.2_8楼后门'} 
    {$_ -like '*_3.*'} {Move-Item -Path $_ -Destination '.3_8楼机房'} 
    {$_ -like '*_4.*'} {Move-Item -Path $_ -Destination '.4_1楼UPS后'} 
    {$_ -like '*_5.*'} {Move-Item -Path $_ -Destination '.5_9楼入口'} 
    {$_ -like '*_6.*'} {Move-Item -Path $_ -Destination '.6_9楼后门'} 
    {$_ -like '*_7.*'} {Move-Item -Path $_ -Destination '.7_9楼机房'} 
    {$_ -like '*_8.*'} {Move-Item -Path $_ -Destination '.8_1楼UPS前'} 
    {$_ -like '*_9.*'} {Move-Item -Path $_ -Destination '.9_CISCO后门'} 
    {$_ -like '*_10.*'} {Move-Item -Path $_ -Destination '.10_CISCO前门'} 
    {$_ -like '*_13.*'} {Move-Item -Path $_ -Destination '.13_10楼入口'} 
    {$_ -like '*_14.*'} {Move-Item -Path $_ -Destination '.14_10楼后门'} 
    {$_ -like '*_15.*'} {Move-Item -Path $_ -Destination '.15_10楼机房前'} 
    {$_ -like '*_16.*'} {Move-Item -Path $_ -Destination '.16_10楼机房后'} 
    } 
    } 
    } 
    #1楼 
    Set-Location -Path P:B8F1 
    $B8F1datefolders = (Get-ChildItem).FullName 
    foreach($B8F1datefolder in $B8F1datefolders) { 
    Set-Location -Path $B8F1datefolder 
    foreach($B8F1Channel in $B8F1Channels) { 
    New-Item $B8F1Channel -ItemType directory -Force 
    } 
    Get-ChildItem | where-object mode -EQ '-a---' | foreach { 
    switch($_.name) { 
    {$_ -like '*_1.*'} {Move-Item -Path $_ -Destination '.1_1楼入口'} 
    {$_ -like '*_2.*'} {Move-Item -Path $_ -Destination '.2_1楼后门'} 
    {$_ -like '*_4.*'} {Move-Item -Path $_ -Destination '.4_1楼机房后'} 
    {$_ -like '*_5.*'} {Move-Item -Path $_ -Destination '.5_1楼机房前'} 
    {$_ -like '*_7.*'} {Move-Item -Path $_ -Destination '.7_1楼UPS'} 
    } 
    } 
    } 
    #2楼 
    Set-Location -Path P:B8F2 
    $B8F2datefolders = (Get-ChildItem).FullName 
    foreach($B8F2datefolder in $B8F2datefolders) { 
    Set-Location -Path $B8F2datefolder 
    foreach($B8F2Channel in $B8F2Channels) { 
    New-Item $B8F2Channel -ItemType directory -Force 
    } 
    Get-ChildItem | where-object mode -EQ '-a---' | foreach { 
    switch($_.name) { 
    {$_ -like '*_1.*'} {Move-Item -Path $_ -Destination '.1_电话机房'} 
    {$_ -like '*_2.*'} {Move-Item -Path $_ -Destination '.2_IFF机房'} 
    {$_ -like '*_3.*'} {Move-Item -Path $_ -Destination '.3_OC机房'} 
    {$_ -like '*_4.*'} {Move-Item -Path $_ -Destination '.4_2楼入口'} 
    {$_ -like '*_5.*'} {Move-Item -Path $_ -Destination '.5_2楼后门'} 
    {$_ -like '*_6.*'} {Move-Item -Path $_ -Destination '.6_Cisco机房'} 
    {$_ -like '*_7.*'} {Move-Item -Path $_ -Destination '.7_Cigna机房'} 
    {$_ -like '*_8.*'} {Move-Item -Path $_ -Destination '.8_Prj 5 机房'} 
    {$_ -like '*_9.*'} {Move-Item -Path $_ -Destination '.9_Cisco入口'} 
    } 
    } 
    } 
    #删除映射盘 
    Set-Location -Path C: 
    Remove-PSDrive P 
  • 相关阅读:
    SCAU 9504 面试
    SCAU 9503 懒人选座位
    SCAU 8628 相亲
    SCAU 10691 ACM 光环
    SCAU 8626 原子量计数
    SCAU 10674 等差对
    HDU ACM 1048 The Hardest Problem Ever (水题)
    SCAU 9502 ARDF
    SCAU 10686 DeathGod不知道的事情
    SCAU 8629 热身游戏(高精度)
  • 原文地址:https://www.cnblogs.com/IvanChen/p/4500778.html
Copyright © 2011-2022 走看看