powershell convert text 20MB to bytes
Shell
$str = '3GB'
$int64 = [int64]$str.Replace('GB','') * 1GBfunction Convert-Size {
[cmdletbinding()]
param(
[validateset("Bytes","KB","MB","GB","TB")]
[string]$From,
[validateset("Bytes","KB","MB","GB","TB")]
[string]$To,
[Parameter(Mandatory=$true)]
[double]$Value,
[int]$Precision = 4
)
switch($From) {
"Bytes" {$value = $Value }
"KB" {$value = $Value * 1024 }
"MB" {$value = $Value * 1024 * 1024}
"GB" {$value = $Value * 1024 * 1024 * 1024}
"TB" {$value = $Value * 1024 * 1024 * 1024 * 1024}
}
switch ($To) {
"Bytes" {return $value}
"KB" {$Value = $Value/1KB}
"MB" {$Value = $Value/1MB}
"GB" {$Value = $Value/1GB}
"TB" {$Value = $Value/1TB}
}
return [Math]::Round($value,$Precision,[MidPointRounding]::AwayFromZero)
}
Also in Shell:
- Title
- powershell convert text 20MB to bytes
- Category
- Shell
- Title
- laravel installation from github
- Category
- Shell
- Title
- How to find cmake version in ubuntu?
- Category
- Shell
- Title
- linux remove folder and all his content
- Category
- Shell
- Title
- kubernetes copy files to persistent volume
- Category
- Shell
- Title
- vagrant 16
- Category
- Shell
- Title
- installing git on mac
- Category
- Shell
- Title
- git show staged files
- Category
- Shell
- Title
- git log one line
- Category
- Shell
- Title
- delete local branch git
- Category
- Shell
- Title
- laravel generate mailable
- Category
- Shell
- Title
- ubuntu wsl windows 10
- Category
- Shell
- Title
- get current branch name git
- Category
- Shell
- Title
- git create new branch
- Category
- Shell
- Title
- restore deleted branch git
- Category
- Shell
- Title
- bash tee stdout and stderr
- Category
- Shell
- Title
- npm install @angular/fire firebase –save
- Category
- Shell
- Title
- ubuntu install opencl
- Category
- Shell
- Title
- create a docker file
- Category
- Shell
- Title
- angular cli generate component
- Category
- Shell
- Title
- ubuntu install composer
- Category
- Shell
- Title
- get random number shell script
- Category
- Shell
- Title
- how to disconnect local repo from remote master
- Category
- Shell
- Title
- install phpmyadmin ubuntu 18.04
- Category
- Shell
- Title
- git delete stash
- Category
- Shell
- Title
- how to download youtube video in linux
- Category
- Shell
- Title
- how to open emulator in vs code
- Category
- Shell
- Title
- bash generate random number between
- Category
- Shell
- Title
- git cherry pick
- Category
- Shell
- Title
- resolv conf linux is being overwritten centos 7
- Category
- Shell
- Title
- add remote in git
- Category
- Shell
- Title
- remove remote git
- Category
- Shell
- Title
- change user linuxcommand ch
- Category
- Shell
- Title
- delete a daemonset deployment
- Category
- Shell
- Title
- linux find file containing text
- Category
- Shell
- Title
- maven install on mac os x
- Category
- Shell
- Title
- read file using shell script
- Category
- Shell
- Title
- git reset hard
- Category
- Shell
- Title
- xampp linux
- Category
- Shell
- Title
- change git password on terminal
- Category
- Shell
- Title
- docker remove image
- Category
- Shell
- Title
- git config ssl verify false
- Category
- Shell
- Title
- rtl8821ce driver linux
- Category
- Shell
- Title
- docker node alpine
- Category
- Shell
- Title
- free port in linux
- Category
- Shell
- Title
- chmode ubuntu
- Category
- Shell
- Title
- react lorem ipsum
- Category
- Shell
- Title
- rustup
- Category
- Shell
- Title
- run mysql xampp shell
- Category
- Shell
- Title
- powershell bulk rename and add extra string to filename
- Category
- Shell
- Title
- ubuntu intall OpenBLAS
- Category
- Shell
- Title
- rails no migration with version number
- Category
- Shell
- Title
- install gulp
- Category
- Shell
- Title
- batch rename files
- Category
- Shell
- Title
- install boostrap react
- Category
- Shell
- Title
- how to create a new group in linux
- Category
- Shell
- Title
- docker force remove container
- Category
- Shell
- Title
- linux find files without string
- Category
- Shell
- Title
- sh declare variable
- Category
- Shell
- Title
- remove mongo lock file from centos 7
- Category
- Shell
- Title
- install opencv
- Category
- Shell
- Title
- Shell query displays all citizens with an age greater than or equal to 21
- Category
- Shell
- Title
- ubuntu sites-available location
- Category
- Shell
- Title
- install chromedriver linux
- Category
- Shell
- Title
- restart service linux crontab
- Category
- Shell
- Title
- linux change hostname
- Category
- Shell
- Title
- how to install react spring
- Category
- Shell
- Title
- git init
- Category
- Shell
- Title
- how to update vs code in linux
- Category
- Shell
- Title
- bash case statement
- Category
- Shell
- Title
- git push repo
- Category
- Shell
- Title
- install gnu grep on mac
- Category
- Shell
- Title
- could not connect to server: Connection refused Is the server running on host and accepting TCP/IP connections on port 5432?
- Category
- Shell
- Title
- npm install express-handlebars
- Category
- Shell
- Title
- gzip folder with tar and exclude directories
- Category
- Shell
- Title
- bash get field from line
- Category
- Shell
- Title
- obs
- Category
- Shell
- Title
- ufw allow postgresql
- Category
- Shell
- Title
- xcode clean derived data command line
- Category
- Shell
- Title
- markdown with dimensions image github
- Category
- Shell
- Title
- dockerfile for vuejs
- Category
- Shell
- Title
- how to connect to the database as root user in linux
- Category
- Shell
- Title
- bash compare two strings
- Category
- Shell
- Title
- tab to csv command line
- Category
- Shell
- Title
- pip installer for mac
- Category
- Shell
- Title
- git delete repository command line
- Category
- Shell
- Title
- bash split variable by delimiter
- Category
- Shell
- Title
- linux min 19.10 install virtualbox
- Category
- Shell
- Title
- how to restart x window manager in ubuntu 18.04
- Category
- Shell
- Title
- pytype
- Category
- Shell
- Title
- statsmodels logit function
- Category
- Shell
- Title
- pylinter not installed vscode pipenv
- Category
- Shell
- Title
- php mysqldump terminal
- Category
- Shell
- Title
- install pygame
- Category
- Shell
- Title
- install onedrive in ubuntu 18.04
- Category
- Shell
- Title
- powershell create service
- Category
- Shell
- Title
- bash count files in directory recursively matchingattern
- Category
- Shell
- Title
- npx create-react-app not working
- Category
- Shell
- Title
- check os shell liunx cygwin darwin
- Category
- Shell
- Title
- crear una aplicación con angular cli
- Category
- Shell