SuperCoolStuff.psm1

function Clear-DowloadsFolder {
    <#
    .DESCRIPTION
    Clears all files out of downloads
    #>


    param (
        [Parameter(Mandatory = $false)]
        [string]$Path = "$env:USERPROFILE\Downloads"
    )

    Get-ChildItem -Path $Path -Recurse | Remove-Item -Force
}

function Get-FileSize {
    <#
    .SYNOPSIS
        Retrieves the size of a specified file.
    .DESCRIPTION
        This function takes a file path as input and returns the size of the file in bytes and gigabytes.
    .PARAMETER FilePath
        The path to the file whose size is to be retrieved.
    .NOTES
        This function is not supported on Linux.
    .LINK
        https://example.com/help/Get-FileSize
    .EXAMPLE
        Get-FileSize -FilePath "C:\example.txt"
        Retrieves the size of the file "example.txt".
    #>


    param (
        [Parameter(Mandatory = $true)]
        [string]$FilePath
    )

    if (Test-Path -Path $FilePath) {
        $sizeInBytes = (Get-Item -Path $FilePath).Length
        $sizeInGB = $sizeInBytes / 1GB
        [PSCustomObject]@{
            FilePath = $FilePath
            SizeInBytes = $sizeInBytes
            SizeInGB = "{0:N2} GB" -f $sizeInGB
        }
    } else {
        Write-Error "File not found: $FilePath"
    }
}

function Get-LimeLargeFile {
    <#
    .SYNOPSIS
        Retrieves large files from a specified directory.
    .DESCRIPTION
        This function searches for and retrieves files larger than a specified size from a given directory.
        It can be used to identify and manage large files that may be consuming significant disk space.
    .PARAMETER SMBPath
        The path to the directory where the search for large files will be conducted.
    .NOTES
        This function is not supported in Linux.
    .LINK
        https://example.com/Get-LimeLargeFile-Help
    .EXAMPLE
        Get-LimeLargeFile -SMBPath "C:\Users\Public\Documents" -MinSize 100MB -Verbose
        Retrieves all files larger than 100MB from the specified directory and displays detailed information.
    #>


    param (
        [Parameter(Mandatory = $true)]
        [string]$SMBPath
    )

    $files = Get-ChildItem -Path $SMBPath -Recurse | Where-Object { $_.Length -gt 12GB }

    $BigFiles = $files | ForEach-Object {
        $sizeInGB = $_.Length / 1GB
        [PSCustomObject]@{
            Name = $_.Name
            Size = "{0:N2} GB" -f $sizeInGB
            Path = $_.FullName
        }
    }
    $BigFiles | Format-Table -AutoSize
}

function Get-MyIP {
    <#
    .SYNOPSIS
        Retrieves the public IP address of the machine.
    .DESCRIPTION
        This function fetches and returns the public IP address of the machine by querying an external service.
        It can be useful for network diagnostics, logging, or any scenario where the public IP is required.
    .NOTES
        This function requires internet access to query the external service.
        It is not supported on systems without internet connectivity.
    .LINK
        https://example.com/Get-MyIP-Help
    .EXAMPLE
        Get-MyIP
        Retrieves and displays the public IP address of the machine.
    #>


    $ip = Invoke-RestMethod -Uri "https://api.ipify.org?format=json"
    $ip.ip
}