Skip to content

Instantly share code, notes, and snippets.

View auberginehill's full-sized avatar

auberginehill

View GitHub Profile
@auberginehill
auberginehill / Remove-EmptyFoldersLite.ps1
Last active May 12, 2018 02:20
A Windows PowerShell script for removing empty folders.
<#
Remove-EmptyFoldersLite.ps1
#>
# $path = "."
$path = "C:\Temp"
$filename = "deleted_folders.txt"
$txt_file = "$env:temp\$filename"
$separator = "---------------------"
$empty_line = ""
@auberginehill
auberginehill / Replace-String.ps1
Last active October 30, 2017 11:05
A code snippet, which replaces every occurrence of a string in a file with PowerShell
<#
Replace-String.ps1
#>
# Description: A code snippet, which replaces every occurrence of a string in a file with PowerShell
# Credit: rominator007: "How can I replace every occurrence of a String in a file with PowerShell?"
# Source: https://stackoverflow.com/questions/17144355/how-can-i-replace-every-occurrence-of-a-string-in-a-file-with-powershell?rq=1
$content = [System.IO.File]::ReadAllText("C:\Temp\example.txt").Replace("OldString","NewValue")
[System.IO.File]::WriteAllText("C:\Temp\example.txt", $content)
@auberginehill
auberginehill / Get-MapUsage.ps1
Last active July 11, 2017 16:49
Tries to retrieve a "number of views" -number from a Google My Maps map and write it to a log file (map_log.csv at $env:temp) - a Windows PowerShell script.
<#
Get-MapUsage.ps1
#>
# Description: Tries to retrieve a "number of views" -number from a Google My Maps map and write it to a log file (map_log.csv at $env:temp).
# Example URL: https://www.google.com/maps/d/viewer?mid=QuiteAFewRandomLettersAndNumbers
# Note: Please replace the string below (between the single quotation marks) with a correct Google My Maps mid, which could be
# either (A) the string after = symbol in the original URL
@auberginehill
auberginehill / Get-TimeDifference.ps1
Last active February 23, 2017 16:21
Examples of time difference calculations (between now and an arbitrary future date) and other date and time related tasks in Windows PowerShell.
<#
Get-TimeDifference.ps1
Windows PowerShell: For a more comfortable reading experience, please type
help ./Get-TimeDifference -Full
#>