Created
June 7, 2026 08:45
-
-
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
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
| # 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