scripts/public/Move-DailyNotes.ps1
function Move-DailyNotes { [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] [OutputType([void])] Param ( [Parameter(Mandatory)] [string] $Path ) if (-not $PSBoundParameters.ContainsKey('ErrorAction')) { [System.Management.Automation.ActionPreference] $ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop } if (-not $PSBoundParameters.ContainsKey('InformationAction')) { [System.Management.Automation.ActionPreference] $InformationPreference = [System.Management.Automation.ActionPreference]::Continue } if (-not $PSBoundParameters.ContainsKey('Verbose')) { [System.Management.Automation.ActionPreference] $VerbosePreference = $PSCmdlet.SessionState.PSVariable.GetValue('VerbosePreference') } else { [bool] $Verbose = $true } if (-not $PSBoundParameters.ContainsKey('Confirm')) { [System.Management.Automation.ActionPreference] $ConfirmPreference = $PSCmdlet.SessionState.PSVariable.GetValue('ConfirmPreference') } if (-not $PSBoundParameters.ContainsKey('WhatIf')) { [System.Management.Automation.ActionPreference] $WhatIfPreference = $PSCmdlet.SessionState.PSVariable.GetValue('WhatIfPreference') } if ($PSCmdlet.ShouldProcess(('{0}\inbox' -f $Path), 'Moves daily smart notes')) { try { $null = Get-ChildItem -Path ('{0}\daily-notes' -f $Path) -Filter '*.md' -File | Move-Item -Destination ('{0}\inbox' -f $Path) } catch { $PSCmdlet.ThrowTerminatingError($PSItem) } } } |