Skip to content

Instantly share code, notes, and snippets.

@dcabines
Created March 6, 2024 16:37
Show Gist options
  • Save dcabines/c5773e8d773c5f7acdb469422e746915 to your computer and use it in GitHub Desktop.
Save dcabines/c5773e8d773c5f7acdb469422e746915 to your computer and use it in GitHub Desktop.
foreach($file in Get-ChildItem -File) {
$folderName = $file.CreationTime.ToString('yyyy-MM-dd')
if (!(Test-Path -Path $folderName -PathType Container))
{
New-Item -Path $folderName -ItemType Directory
}
Move-Item -Path $file -Destination $folderName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment