Forum Discussion
How to create new folders and rename faster?
I want to keep on creating new folders with first number increasing and date increasing forever everyday like this.
[1 140125] meaning folder number 1, date is 14 (meaning 14th of that month), month is 01 (meaning Jan), year is 25 (meaning 2025)
Q1. How can I continue to create it in a faster way? (currently I create a new folder and type in the number and date)
Q2. How to create a new folder named [misc] inside every folder in a fast way? (currently I open every folder then manually create a new folder and type in the name [misc])
1 Reply
- SivertSolemIron Contributor
I have some questions back.
Is it neccessary to number the folders, and if yes, why?
"Alphanumeric" sorting would place 1, 10, 100 next to each other, then 2, 20, 200 etc.For date strings that need to be sorted alphanumerically, the ISO 8601 date format is recommended, 2025-04-14 (yyyy-mm-dd).
This format would sort correctly by date.As for speed:
- ctrl+shift+n creates a new folder, with the name selected and ready to be overwritten.
- Probably some powershell, see below. Creates the [misc] folder as well.
I recommend copying to ISE and running from there.
Set-Location 'C:\temp\' $index = 1 #Counter $startDate = Get-Date('2025-04-14') #Date of first folder $numDirectories = 10 #Number of folders for ($index; $index -le $numDirectories; $index++) { # Increment date $currDate = $startDate.AddDays($index-1) #Construct the directory name, using the format operator (https://ss64.com/ps/syntax-f-operator.html) $DirectoryName = '{0} {1:d2}{2:d2}{3:d2}' -f $index, $currDate.Day, $currDate.Month, $($currDate.Year - 2000) # Improved sorting, padding index to 4 digits # $DirectoryName = '{0:d4} {1:d2}{2:d2}{3:d2}' -f $index, $currDate.Day, $currDate.Month, $($currDate.Year - 2000) # Alternate ISO 8601 version # $DirectoryName = '{0:d4}-{1:d2}-{2:d2}' -f $currDate.Year, $currDate.Month, $currDate.Day Write-Information $('Testing directory {0}' -f $DirectoryName) If (-not $(Test-Path -Path $('.\{0}' -f $DirectoryName))) { Write-Information $('Directory {0} does not exist, creating' -f $DirectoryName) New-Item -ItemType Directory -Name $DirectoryName Write-Information $('Creating Misc') New-Item -ItemType Directory -Path $DirectoryName -Name '[misc]' } }