Skip to content

Instantly share code, notes, and snippets.

@prav-raghu
Created June 7, 2026 08:45
Show Gist options
  • Select an option

  • Save prav-raghu/2357aef71f584da50e8f573e6972df71 to your computer and use it in GitHub Desktop.

Select an option

Save prav-raghu/2357aef71f584da50e8f573e6972df71 to your computer and use it in GitHub Desktop.
Create a folder in a windows system with the current date into the downloads folder
# Get the path to the Downloads folder
$downloadsPath = [System.IO.Path]::Combine([System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::UserProfile), 'Downloads')
# Get the current date in 'dd-MM-yyyy' format
$today = (Get-Date).ToString("dd-MM-yyyy")
# Define the new folder path
$newFolderPath = Join-Path -Path $downloadsPath -ChildPath $today
# Check if the folder already exists; if not, create it
if (-not (Test-Path $newFolderPath)) {
New-Item -Path $newFolderPath -ItemType Directory
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment