Skip to content

Instantly share code, notes, and snippets.

@kinshuk4
Last active February 22, 2017 22:41
Show Gist options
  • Save kinshuk4/9c3034aedccda9f7c31ac2ef123a57e3 to your computer and use it in GitHub Desktop.
Save kinshuk4/9c3034aedccda9f7c31ac2ef123a57e3 to your computer and use it in GitHub Desktop.
//remove 4 from the file name and replace it with empty string
get-childitem -path c:\test -filter *4* -Recurse | rename-item -newname {$_.name -replace "4",""}
get-childitem -path G:\Lyf\EDU2 -filter *’* -Recurse | rename-item -newname {$_.name -replace "’",""}
gci G:\Lyf\EDU2\2\Coursera\FIN -r *.csv `
| Where-Object { ... } `
| ForEach-Object { & 7z $_.FullName".zip" $_.FullName}
Compress-Archive -Path
7z a b.zip b
gci C:\temp -r *.csv `
| Where-Object { ... } `
| ForEach-Object { & 'c:\temp\bin\gzip.exe' $_.FullName}
G:\Lyf\EDU2\3\Coursera\CS
$dir = dir G:\Lyf\EDU2\3\Coursera\CS | ?{$_.PSISContainer}
foreach ($d in $dir){
$name = Join-Path -Path $d.FullName -ChildPath ($d.Name + ".zip")
$path = Join-Path -Path $d.FullName -ChildPath "*"
& "7z" a $name $path
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment