power shell upload file to azure storage
2016-01-20 13:28
621 查看
# Azure subscription-specific variables. $storageAccountName = "storage-account-name" $containerName = "container-name" # Find the local folder where this PowerShell script is stored. $currentLocation = Get-location $thisfolder = Split –parent $currentLocation # Upload files in data subfolder to Azure. $localfolder = "$thisfolder\data" $destfolder = "data" $storageAccountKey = (Get-AzureStorageKey -StorageAccountName $storageAccountName).Primary $blobContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey $files = Get-ChildItem $localFolder foreach($file in $files) { $fileName = "$localFolder\$file" $blobName = "$destfolder/$file" write-host "copying $fileName to $blobName" Set-AzureStorageBlobContent -File $filename -Container $containerName -Blob $blobName -Context $blobContext -Force } write-host "All files in $localFolder uploaded to $containerName!"
相关文章推荐
- shell脚本 -d 是目录文件,那么-e,-f等说明
- Lvs别样的自动部署监控shell脚本
- 搞笑的Linux shell
- Android Java代码执行adb Shell命令
- 玩转Bash变量
- (六)、HDFS 常用 shell 操作
- erlang shell表格数据对齐
- Shell脚本统计文件行数的8种方法
- centos shell脚本编程1 正则 shell脚本结构 read命令 date命令的用法 shell中的逻辑判断 if 判断文件、目录属性 shell数组简单用法 $( ) 和${ } 和$(( )) 与 sh -n sh -x sh -v 第三十五节课
- C语言33行代码简单实现Shell
- C语言实现shell框架
- shell脚本标准输出赋值给变量
- shell判断字符串为空
- shell循环
- shell括号
- 【Shell】sed
- shell死循环
- shell按行读取文件
- hadoop FS Shell
- shell命令使用HDFS的一些其他命令