Created
March 19, 2025 18:48
-
-
Save jimdiroffii/ae30bec7c9bac7ee8e5213d38c835e1d to your computer and use it in GitHub Desktop.
Create a full list of HTTP Status Codes as folders using Powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$httpStatusCodes = @( | |
@{ Code = "100"; Description = "Continue" } | |
@{ Code = "101"; Description = "Switching Protocols" } | |
@{ Code = "102"; Description = "Processing" } | |
@{ Code = "103"; Description = "Early Hints" } | |
@{ Code = "200"; Description = "OK" } | |
@{ Code = "201"; Description = "Created" } | |
@{ Code = "202"; Description = "Accepted" } | |
@{ Code = "203"; Description = "Non-Authoritative Information" } | |
@{ Code = "204"; Description = "No Content" } | |
@{ Code = "205"; Description = "Reset Content" } | |
@{ Code = "206"; Description = "Partial Content" } | |
@{ Code = "207"; Description = "Multi-Status" } | |
@{ Code = "208"; Description = "Already Reported" } | |
@{ Code = "226"; Description = "IM Used" } | |
@{ Code = "300"; Description = "Multiple Choices" } | |
@{ Code = "301"; Description = "Moved Permanently" } | |
@{ Code = "302"; Description = "Found" } | |
@{ Code = "303"; Description = "See Other" } | |
@{ Code = "304"; Description = "Not Modified" } | |
@{ Code = "307"; Description = "Temporary Redirect" } | |
@{ Code = "308"; Description = "Permanent Redirect" } | |
@{ Code = "400"; Description = "Bad Request" } | |
@{ Code = "401"; Description = "Unauthorized" } | |
@{ Code = "402"; Description = "Payment Required" } | |
@{ Code = "403"; Description = "Forbidden" } | |
@{ Code = "404"; Description = "Not Found" } | |
@{ Code = "405"; Description = "Method Not Allowed" } | |
@{ Code = "406"; Description = "Not Acceptable" } | |
@{ Code = "407"; Description = "Proxy Authentication Required" } | |
@{ Code = "408"; Description = "Request Timeout" } | |
@{ Code = "409"; Description = "Conflict" } | |
@{ Code = "410"; Description = "Gone" } | |
@{ Code = "411"; Description = "Length Required" } | |
@{ Code = "412"; Description = "Precondition Failed" } | |
@{ Code = "413"; Description = "Content Too Large" } | |
@{ Code = "414"; Description = "URI Too Long" } | |
@{ Code = "415"; Description = "Unsupported Media Type" } | |
@{ Code = "416"; Description = "Range Not Satisfiable" } | |
@{ Code = "417"; Description = "Expectation Failed" } | |
@{ Code = "418"; Description = "I'm a teapot" } | |
@{ Code = "421"; Description = "Misdirected Request" } | |
@{ Code = "422"; Description = "Unprocessable Content" } | |
@{ Code = "423"; Description = "Locked" } | |
@{ Code = "424"; Description = "Failed Dependency" } | |
@{ Code = "425"; Description = "Too Early" } | |
@{ Code = "426"; Description = "Upgrade Required" } | |
@{ Code = "428"; Description = "Precondition Required" } | |
@{ Code = "429"; Description = "Too Many Requests" } | |
@{ Code = "431"; Description = "Request Header Fields Too Large" } | |
@{ Code = "451"; Description = "Unavailable For Legal Reasons" } | |
@{ Code = "500"; Description = "Internal Server Error" } | |
@{ Code = "501"; Description = "Not Implemented" } | |
@{ Code = "502"; Description = "Bad Gateway" } | |
@{ Code = "503"; Description = "Service Unavailable" } | |
@{ Code = "504"; Description = "Gateway Timeout" } | |
@{ Code = "505"; Description = "HTTP Version Not Supported" } | |
@{ Code = "506"; Description = "Variant Also Negotiates" } | |
@{ Code = "507"; Description = "Insufficient Storage" } | |
@{ Code = "508"; Description = "Loop Detected" } | |
@{ Code = "510"; Description = "Not Extended" } | |
@{ Code = "511"; Description = "Network Authentication Required" } | |
) | |
foreach ($status in $httpStatusCodes) { | |
$folderName = "$($status.Code) - $($status.Description)" | |
if (-not (Test-Path -Path $folderName)) { | |
New-Item -ItemType Directory -Name $folderName | Out-Null | |
Write-Output "Created folder: $folderName" | |
} | |
else { | |
Write-Output "Folder already exists: $folderName" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment