Make script to ease mundane task
sillymcnasty
Member Posts: 254 ■■■□□□□□□□
in Off-Topic
At work I have to make a new folder for every weekday. Example, today would be 060817. Within that folder, I need 3 folders. Folder 1, Folder2, Folder3. Let's just say for current month.
So example, with terrible coding lingo.
If month=June, today = weekday, make folder using MMDDYY, and within that folder, create Folder1, Folder2, Folder3.
Would that be simple to do? This would be windows environment. I've never scripted anything before. Sure spoonfeeding is nice, but if anyone wants to point me to a place where it teaches and I can learn it, that'd be nice too.
Thanks.
So example, with terrible coding lingo.
If month=June, today = weekday, make folder using MMDDYY, and within that folder, create Folder1, Folder2, Folder3.
Would that be simple to do? This would be windows environment. I've never scripted anything before. Sure spoonfeeding is nice, but if anyone wants to point me to a place where it teaches and I can learn it, that'd be nice too.
Thanks.
Comments
-
uptheirons73 Registered Users Posts: 4 ■■■□□□□□□□I think this would be super easy with Powershell. If you have not used it before just google it. It is a good skill to have.
-
TheFORCE Member Posts: 2,297 ■■■■■■■■□□
-
sillymcnasty Member Posts: 254 ■■■□□□□□□□Thanks, but that link made me realize I worded it wrong. Often times I have to create these folders a week in advance. Sooooo. More accurate scenario:
Create a script that would create a folder for every weekday of the month? Say I run it June 1 and it creates the entire's month worth of folders. -
NetworkNewb Member Posts: 3,298 ■■■■■■■■■□You would just have to make a script that looped through the days, check the dayofweek property when it looped through the days to see if it doesn't equal Saturday or Sunday, if it doesn't create a folder.
Found the following to find the first and last day of the months..
$startofmonth = Get-Date $date -day 1 -hour 0 -minute 0 -second 0
$endofmonth = (($startofmonth).AddMonths(1).AddSeconds(-1))
GL -
sillymcnasty Member Posts: 254 ■■■□□□□□□□Thanks. It might take a while since I'm preoccupied. But it'll be nice worthwhile experience.