文件夹存在与否
- 文件夹是否存在。
1 2 3 4 5 6 7 8 9 10 11 12 |
$script_dir = Split-Path -Parent $MyInvocation.MyCommand.Definition $dic_dir = Join-Path $script_dir "soui\bin" $gloa_dir = Join-Path $script_dir "soui\bin_dll" $exist = (Test-Path $gloa_dir) if ($exist -ne "True") { $exist = (Test-Path $dic_dir) if ($exist -eq "True") { Rename-Item $dic_dir $gloa_dir } } |
创建文件文件夹
文件夹
1 |
New-Item -Path 'C:\temp\New Folder' -ItemType Directory |
空的文件
1 |
New-Item -Path 'C:\temp\New Folder\aet.txt' -ItemType File |
拷贝
文件
1 2 3 |
Copy-Item -Path C:\aet.ini -Destination C:\aet.bak Copy-Item -Path C:\aet.ini -Destination C:\aet.bak -Force |
文件夹
1 2 3 |
Copy-Item C:\temp\lif -Recurse C:\temp\lifw Copy-Item -Filter *.txt -Path C:\temp\lif C:\temp\lifwtxt |
重命名
1 2 3 4 5 6 7 8 9 10 11 12 |
$script_dir = Split-Path -Parent $MyInvocation.MyCommand.Definition $dic_dir = Join-Path $script_dir "soui\bin" $gloa_dir = Join-Path $script_dir "soui\bin_dll" $exist = (Test-Path $gloa_dir) if ($exist -ne "True") { $exist = (Test-Path $dic_dir) if ($exist -eq "True") { Rename-Item $dic_dir $gloa_dir } } |
上传文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
// 未完善 未通过测试 $script_dir = Split-Path -Parent $MyInvocation.MyCommand.Definition $all_pdb_dir = Join-Path $script_dir "all_pdb" echo $script_dir $destination="ftp://Administrator:yfb.xunyou2016.com@192.168.1.19/pdb_ci" $webclient = New-Object -TypeName System.Net.WebClient foreach ($pdb_file in $all_pdb_dir) { Write-Host "Uploading $pdb_file" $webclient.UploadFile("$destination/$pdb_file", $pdb_file.FullName) } $webclient.Dispose() |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
// 未完善 未通过测试 $script_dir = Split-Path -Parent $MyInvocation.MyCommand.Definition $all_pdb_dir = Join-Path $script_dir "all_pdb" echo $script_dir $destination="ftp://Administrator:yfb.xunyou2016.com@192.168.1.19/pdb_ci" $webclient = New-Object -TypeName System.Net.WebClient foreach ($pdb_file in $all_pdb_dir) { Write-Host "Uploading $pdb_file" $webclient.UploadFile("$destination/$pdb_file", $pdb_file.FullName) } $webclient.Dispose() |
本文为原创文章,版权归Aet所有,欢迎分享本文,转载请保留出处!
你可能也喜欢
- ♥ Linux_ 命令大全 电子邮件与新闻组03/16
- ♥ 【AcWing 语法基础课 第七八讲】03/03
- ♥ Linux 进程创建&&控制&&终止03/28
- ♥ Reading 2020 《心理学与生活》05/25
- ♥ Linux 信号处理一03/24
- ♥ C++11_第三篇12/06
热评文章
- * 暂无