#建立远程服务器的文件夹映射
$pw = ConvertTo-SecureString '密码' -AsPlainText -Force
$Creds = New-Object -Typename System.Management.Automation.PSCredential -Argumentlist "cnhzsrv11\ultraman", $pw
$target = New-PSDrive -Name P -PSProvider FileSystem -Root '\\cnhzsrv11\D$\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

最新文章

  1. i5 6300HQ 和 i7 6700HQ
  2. 重写onStart()函数
  3. HTML5和CSS3的学习视频
  4. [转] JavaScript 和事件
  5. Preemption Context Switches 和 Synchronization Context Switches
  6. Log4j NDC MDC
  7. Linux解决MySQL-python安装失败问题
  8. 要求必须全部重复的数据sql--想了半天才写出来的
  9. Dreamweaver编辑区下方的属性栏显示
  10. Centos 7 安装 ELK 5.6.8 及基础的配置
  11. ML_Clustering
  12. numpy库数组拼接np.concatenate的用法
  13. SSM实战——秒杀系统之Web层Restful url设计、SpringMVC整合、页面设计
  14. Linux MySQl 5.7.17 MySQL ERROR 1366(HY000):Incorrect string value 解决方法
  15. [ZJOI2011]细胞——斐波那契数列+矩阵加速+dp
  16. JSOI 2017 退役记
  17. Python测试Kafka集群(kafka-python)
  18. 红帽企业版RHEL7.1在研域工控板上,开机没有登陆窗口 -- 编写xorg.conf 简单三行解决Ubuntu分辩率不可调的问题
  19. 关于IT术语---ip、uv、pv、tps、qps、rps
  20. Android简单的利用MediaRecorder进行录音的实例代码

热门文章

  1. myeclipse高版本对应tomcat低版本解决办法
  2. 【数据结构】hanoi
  3. CUDA学习笔记(二)——CUDA线程模型
  4. yum rpm
  5. Windows 10 下ASP.NET4.0尚未在Web服务器上注册
  6. Visual Studio一秒变Node.js IDE
  7. 使用SQL Server维护计划实现数据库定时自动备份
  8. PDA手持终端在ERP系统仓库管理出入库盘点环节的应用
  9. http://jingyan.baidu.com/article/db55b609aac41e4ba30a2f86.html
  10. Quartz.net misfire实践