Powershell split file

#网上所得非原创

function split($inFile, $outPrefix, [Int32] $bufSize){

$stream = [System.IO.File]::OpenRead($inFile)
$chunkNum = 1
$barr = New-Object byte[] $bufSize

while( $bytesRead = $stream.Read($barr,0,$bufsize)){
$outFile = "$outPrefix$chunkNum"
$ostream = [System.IO.File]::OpenWrite($outFile)
$ostream.Write($barr,0,$bytesRead);
$ostream.close();
echo "wrote $outFile"
$chunkNum += 1
}
}

split ‘F:\log\u_ex141125.log‘ ‘F:\log\iis‘ 1000

时间: 2024-08-11 04:52:46

Powershell split file的相关文章

Powershell About File System

File System Rights Get-Acl $sharepath | select -expand access | where { !$_.IsInherited -AND $_.filesystemrights -eq 'fullcontrol'} Get-Acl $sharepath | select -expand access | where {($_.identityreference -eq "everyone") -and ($_.InheritanceFla

Powershell Get File/Disk Size

知识点: 1.获取路径中的文件夹:Get-ChildItem $startFolder  | Where-Object {$_.PSIsContainer -eq $True} | Sort-Object 2.获取文件夹的总大小Get-ChildItem $i.FullName -recurse | Measure-Object -property length -sum 3. 正则表达式:$DBname=  $fullname -replace "^.*data\\" . 文档:\\

32. PowerShell -- 批处理中执行远程的powershell脚本的方法

Copy powershell.ps1 from \\fileserver\scripts  to  "%systemdrive%\Tools\Scripts" local computer; REM powershell.ps1 filerobocopy \\filerserver\Scripts %systemdrive%\Tools\Scripts powershell.ps1 Execute the powershell.ps1 file REM Execute  powers

Azure File SMB3.0文件共享服务(2)

使用Powershell创建文件共享 Azure的文件存储结构如下所示,最基本的文件存储包含存储账号,文件共享,在文件共享下面你可以建立文件目录,上传文件: 在开始使用Powershell创建文件共享之前,你需要获得Azure的账号,安装powershell,配置你的账号,请参考我以前的博客,在此不再赘述. 首先,创建Azure storage account,需要设置你的storage账号的名称,以及你的存储账号是创建在那个region,比如中国东部: $StorageAccountName=

JAVA基础学习day21--IO流三-File、Properties、PrintWriter与合并、分割流

一.File 1.1.File概述 文件和目录路径名的抽象表示形式. 用户界面和操作系统使用与系统相关的路径名字符串 来命名文件和目录.此类呈现分层路径名的一个抽象的.与系统无关的视图.抽象路径名 有两个组件: 一个可选的与系统有关的前缀 字符串,比如盘符,"/" 表示 UNIX 中的根目录,"\\\\" 表示 Microsoft Windows UNC 路径名. 零个或更多字符串名称 的序列. 字段摘要 static String pathSeparator 与系

15 Linux Split and Join Command Examples to Manage Large Files--reference

by HIMANSHU ARORA on OCTOBER 16, 2012 http://www.thegeekstuff.com/2012/10/15-linux-split-and-join-command-examples-to-manage-large-files/ Linux split and join commands are very helpful when you are manipulating large files. This article explains how

hadoop学习WordCount+Block+Split+Shuffle+Map+Reduce技术详解

转自:http://blog.csdn.net/yczws1/article/details/21899007 纯干货:通过WourdCount程序示例:详细讲解MapReduce之Block+Split+Shuffle+Map+Reduce的区别及数据处理流程. Shuffle过程是MapReduce的核心,集中了MR过程最关键的部分.要想了解MR,Shuffle是必须要理解的.了解Shuffle的过程,更有利于我们在对MapReduce job性能调优的工作有帮助,以及进一步加深我们对MR内

python split的使用

split是分隔字符的(貌似类似于cut) >>> a= '192.168.1.60 root 22 111111' >>> a '192.168.1.60 root 22 111111' >>> a.split()默认以空格为分隔 ['192.168.1.60', 'root', '22', '111111'] >>> b='my..name..is..ghn' >>> b 'my..name..is..ghn'

WindowsAzure Powershell脚本定时启动关机Azure VM

说到windowsazure对于当下不是一个新鲜话题了,但是对于功能来说还是有点期待的,毕竟在云服务的世界里windowsazure还是一个菜鸟了.同样我们都知道,对于windowsazure上的服务操作我们有很多方式可以操作,比如:portal页面,powershell with azure及azure pack等,其他的都是图形界面操作,操作相对简单,今天咱们就说说通过windows azure powershell命令来管理windows azure上的部分服务,powershell操作命