文件夹存在与否
- 文件夹是否存在。
|
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所有,欢迎分享本文,转载请保留出处!
你可能也喜欢
- ♥ 中国近代史07/13
- ♥ Cef:沙盒、CefApp、CefClient02/29
- ♥ 【Javascript】对象引用复制05/18
- ♥ Reading 2020 《呐喊》09/28
- ♥ Windows开发相关工具03/21
- ♥ Macos编译x86_64相关一04/25
热评文章
- * 暂无