powershell - Shortcut that points to folder named the current date. YYYY_MM_DD Format -
so part of daily project. each day, create new folder store of our files day. named according current date, counter added front representing 'episode'. format wxyz_yyyy_mm_dd.
ex:
0001_2013-05-09
0002_2013-05-10
0003_2013-05-13
0004_2013-05-14
the folders being created, need make shortcut take 'current' folder day.
after working out options, seems powershell straightforward. know need use scheduler here, torn between deleting existing shortcuts create new one, or editing existing shortcut path values. not sure how increment episode , append date value. want appending strings here?
i'm more versed in c++, , java shells. haven't worked them in long while here appreciated.
you can create shortcuts in powershell using following.
$sh = new-object -comobject wscript.shell $shortcut = $sh.createshortcut("c:\latest_folder.lnk") $shortcut.targetpath = "c:\foo\bar.txt" $shortcut.save()
you don't need remove old 1 each time. if execute same code overwrite old shortcut.
for grabbing latest folder can use following line.
$file = get-childitem -path "c:\foo" | sort-object -descending lastwritetime | select -first 1
$file.fullname give full path folder/file.
Comments
Post a Comment