文件夹存在与否
- 文件夹是否存在。
|
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所有,欢迎分享本文,转载请保留出处!
你可能也喜欢
- ♥ Boost程序库完全开发指南:时间与内存08/21
- ♥ Linux下调试dump记录08/11
- ♥ 索引相关10/28
- ♥ 表操作_条件查询-运算符10/23
- ♥ C++标准模板库编程实战_关联容器12/07
- ♥ Windbg:命令实践详解二03/28
热评文章
- * 暂无