Is it possible to have a shortcut to newest subfolder?












0















Everyday I have a new subfolder inside a Windows 10 directory.



I need to manually open the folder, and manually find the newest folder to store a file. There are already hundreds of subfolders.



I need to use a folder dialog from a program, which asks me to find the folder to store a file, so I cannot configure the folder dialog to sort by date, but I can use folder shortcuts.



Is it possible to make a shortcut to the newest subfolder of a directory in Windows 10?










share|improve this question





























    0















    Everyday I have a new subfolder inside a Windows 10 directory.



    I need to manually open the folder, and manually find the newest folder to store a file. There are already hundreds of subfolders.



    I need to use a folder dialog from a program, which asks me to find the folder to store a file, so I cannot configure the folder dialog to sort by date, but I can use folder shortcuts.



    Is it possible to make a shortcut to the newest subfolder of a directory in Windows 10?










    share|improve this question



























      0












      0








      0








      Everyday I have a new subfolder inside a Windows 10 directory.



      I need to manually open the folder, and manually find the newest folder to store a file. There are already hundreds of subfolders.



      I need to use a folder dialog from a program, which asks me to find the folder to store a file, so I cannot configure the folder dialog to sort by date, but I can use folder shortcuts.



      Is it possible to make a shortcut to the newest subfolder of a directory in Windows 10?










      share|improve this question
















      Everyday I have a new subfolder inside a Windows 10 directory.



      I need to manually open the folder, and manually find the newest folder to store a file. There are already hundreds of subfolders.



      I need to use a folder dialog from a program, which asks me to find the folder to store a file, so I cannot configure the folder dialog to sort by date, but I can use folder shortcuts.



      Is it possible to make a shortcut to the newest subfolder of a directory in Windows 10?







      windows-10 windows-explorer file-shortcut






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 6 at 23:59









      phuclv

      9,98164093




      9,98164093










      asked Feb 5 at 12:09









      cohoriditcohoridit

      24




      24






















          2 Answers
          2






          active

          oldest

          votes


















          1














          You could make a Powershell script to do it. Use Get-ChildItem to find most recent folder and then WScript.shell to make a new shortcut.



          For example :



          # Default locations
          $FolderRoot="D:Temp"
          $Shortcut="D:TempLatest.lnk"

          # Get latest folder in root folder
          $Latest = Get-ChildItem $FolderRoot -dir | sort CreationTime | Select -last 1

          # Delete old shortcut
          if (Test-Path $Shortcut){Remove-Item $Shortcut}

          # Create new shortcut
          $WshShell=New-Object -ComObject WScript.Shell
          $NewShortcut=$WshShell.CreateShortcut($Shortcut)
          $NewShortcut.TargetPath = $Latest[0].FullName
          $NewShortcut.Save()


          If you save this as .ps1 file then you can run it daily and it will update the shortcut Latest.lnk to point to whatever the latest folder is.






          share|improve this answer































            0














            Explorer and the Windows' file open dialog support sorting the folder as Creation time, no script is needed. Although it'll just sort by modified date by default, you can select Sort by > More and choose the appropriate item. Once set, explorer will remember the sorting option and then every time you open it the latest one will always be at the top, no script is needed



            You can also create a symlink to the latest folder instead of a shortcut using cmd



            rd newestDir
            for /f "tokens=*" %%a in ('dir /b /a:d /t:c /od') do set newest=%%a
            mklink /J pathtonewestDir "%newest%"


            or powershell



            $newest = Get-ChildItem "pathtoroot" -Directory | Sort-Object CreationTime | Select-Object -Last 1
            New-Item -Path pathtonewestDir -ItemType SymbolicLink -Value "$newest" -Force


            The above commands will create a symlink named pathtonewestDir that points to the latest folder





            If you open the folder from shells you can open it directly from command line instead of creating a shortcut and update it every day



            With powershell you need only one line



            start $(Get-ChildItem "pathtoroot" -Directory | Sort-Object CreationTime | Select-Object -Last 1)


            You can change the last part to Sort-Object CreationTime -Descending | Select-Object -First 1, or shorten it to



            start $(ls "pathtoroot" -dir | sort CreationTime | select -last 1)


            In cmd you can use this



            for /f "tokens=*" %%a in ('dir /b /a:d /t:c /od') do set newest=%%a
            start %newest%


            Alternatively this also work



            for /f "tokens=*" %%a in ('dir /b /a:d /t:c /o:-d') do (start "" "%%a" & exit /B)


            exit /B can also be changed to goto :eof






            share|improve this answer

























              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "3"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1402227%2fis-it-possible-to-have-a-shortcut-to-newest-subfolder%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              You could make a Powershell script to do it. Use Get-ChildItem to find most recent folder and then WScript.shell to make a new shortcut.



              For example :



              # Default locations
              $FolderRoot="D:Temp"
              $Shortcut="D:TempLatest.lnk"

              # Get latest folder in root folder
              $Latest = Get-ChildItem $FolderRoot -dir | sort CreationTime | Select -last 1

              # Delete old shortcut
              if (Test-Path $Shortcut){Remove-Item $Shortcut}

              # Create new shortcut
              $WshShell=New-Object -ComObject WScript.Shell
              $NewShortcut=$WshShell.CreateShortcut($Shortcut)
              $NewShortcut.TargetPath = $Latest[0].FullName
              $NewShortcut.Save()


              If you save this as .ps1 file then you can run it daily and it will update the shortcut Latest.lnk to point to whatever the latest folder is.






              share|improve this answer




























                1














                You could make a Powershell script to do it. Use Get-ChildItem to find most recent folder and then WScript.shell to make a new shortcut.



                For example :



                # Default locations
                $FolderRoot="D:Temp"
                $Shortcut="D:TempLatest.lnk"

                # Get latest folder in root folder
                $Latest = Get-ChildItem $FolderRoot -dir | sort CreationTime | Select -last 1

                # Delete old shortcut
                if (Test-Path $Shortcut){Remove-Item $Shortcut}

                # Create new shortcut
                $WshShell=New-Object -ComObject WScript.Shell
                $NewShortcut=$WshShell.CreateShortcut($Shortcut)
                $NewShortcut.TargetPath = $Latest[0].FullName
                $NewShortcut.Save()


                If you save this as .ps1 file then you can run it daily and it will update the shortcut Latest.lnk to point to whatever the latest folder is.






                share|improve this answer


























                  1












                  1








                  1







                  You could make a Powershell script to do it. Use Get-ChildItem to find most recent folder and then WScript.shell to make a new shortcut.



                  For example :



                  # Default locations
                  $FolderRoot="D:Temp"
                  $Shortcut="D:TempLatest.lnk"

                  # Get latest folder in root folder
                  $Latest = Get-ChildItem $FolderRoot -dir | sort CreationTime | Select -last 1

                  # Delete old shortcut
                  if (Test-Path $Shortcut){Remove-Item $Shortcut}

                  # Create new shortcut
                  $WshShell=New-Object -ComObject WScript.Shell
                  $NewShortcut=$WshShell.CreateShortcut($Shortcut)
                  $NewShortcut.TargetPath = $Latest[0].FullName
                  $NewShortcut.Save()


                  If you save this as .ps1 file then you can run it daily and it will update the shortcut Latest.lnk to point to whatever the latest folder is.






                  share|improve this answer













                  You could make a Powershell script to do it. Use Get-ChildItem to find most recent folder and then WScript.shell to make a new shortcut.



                  For example :



                  # Default locations
                  $FolderRoot="D:Temp"
                  $Shortcut="D:TempLatest.lnk"

                  # Get latest folder in root folder
                  $Latest = Get-ChildItem $FolderRoot -dir | sort CreationTime | Select -last 1

                  # Delete old shortcut
                  if (Test-Path $Shortcut){Remove-Item $Shortcut}

                  # Create new shortcut
                  $WshShell=New-Object -ComObject WScript.Shell
                  $NewShortcut=$WshShell.CreateShortcut($Shortcut)
                  $NewShortcut.TargetPath = $Latest[0].FullName
                  $NewShortcut.Save()


                  If you save this as .ps1 file then you can run it daily and it will update the shortcut Latest.lnk to point to whatever the latest folder is.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 5 at 23:02









                  lx07lx07

                  602411




                  602411

























                      0














                      Explorer and the Windows' file open dialog support sorting the folder as Creation time, no script is needed. Although it'll just sort by modified date by default, you can select Sort by > More and choose the appropriate item. Once set, explorer will remember the sorting option and then every time you open it the latest one will always be at the top, no script is needed



                      You can also create a symlink to the latest folder instead of a shortcut using cmd



                      rd newestDir
                      for /f "tokens=*" %%a in ('dir /b /a:d /t:c /od') do set newest=%%a
                      mklink /J pathtonewestDir "%newest%"


                      or powershell



                      $newest = Get-ChildItem "pathtoroot" -Directory | Sort-Object CreationTime | Select-Object -Last 1
                      New-Item -Path pathtonewestDir -ItemType SymbolicLink -Value "$newest" -Force


                      The above commands will create a symlink named pathtonewestDir that points to the latest folder





                      If you open the folder from shells you can open it directly from command line instead of creating a shortcut and update it every day



                      With powershell you need only one line



                      start $(Get-ChildItem "pathtoroot" -Directory | Sort-Object CreationTime | Select-Object -Last 1)


                      You can change the last part to Sort-Object CreationTime -Descending | Select-Object -First 1, or shorten it to



                      start $(ls "pathtoroot" -dir | sort CreationTime | select -last 1)


                      In cmd you can use this



                      for /f "tokens=*" %%a in ('dir /b /a:d /t:c /od') do set newest=%%a
                      start %newest%


                      Alternatively this also work



                      for /f "tokens=*" %%a in ('dir /b /a:d /t:c /o:-d') do (start "" "%%a" & exit /B)


                      exit /B can also be changed to goto :eof






                      share|improve this answer






























                        0














                        Explorer and the Windows' file open dialog support sorting the folder as Creation time, no script is needed. Although it'll just sort by modified date by default, you can select Sort by > More and choose the appropriate item. Once set, explorer will remember the sorting option and then every time you open it the latest one will always be at the top, no script is needed



                        You can also create a symlink to the latest folder instead of a shortcut using cmd



                        rd newestDir
                        for /f "tokens=*" %%a in ('dir /b /a:d /t:c /od') do set newest=%%a
                        mklink /J pathtonewestDir "%newest%"


                        or powershell



                        $newest = Get-ChildItem "pathtoroot" -Directory | Sort-Object CreationTime | Select-Object -Last 1
                        New-Item -Path pathtonewestDir -ItemType SymbolicLink -Value "$newest" -Force


                        The above commands will create a symlink named pathtonewestDir that points to the latest folder





                        If you open the folder from shells you can open it directly from command line instead of creating a shortcut and update it every day



                        With powershell you need only one line



                        start $(Get-ChildItem "pathtoroot" -Directory | Sort-Object CreationTime | Select-Object -Last 1)


                        You can change the last part to Sort-Object CreationTime -Descending | Select-Object -First 1, or shorten it to



                        start $(ls "pathtoroot" -dir | sort CreationTime | select -last 1)


                        In cmd you can use this



                        for /f "tokens=*" %%a in ('dir /b /a:d /t:c /od') do set newest=%%a
                        start %newest%


                        Alternatively this also work



                        for /f "tokens=*" %%a in ('dir /b /a:d /t:c /o:-d') do (start "" "%%a" & exit /B)


                        exit /B can also be changed to goto :eof






                        share|improve this answer




























                          0












                          0








                          0







                          Explorer and the Windows' file open dialog support sorting the folder as Creation time, no script is needed. Although it'll just sort by modified date by default, you can select Sort by > More and choose the appropriate item. Once set, explorer will remember the sorting option and then every time you open it the latest one will always be at the top, no script is needed



                          You can also create a symlink to the latest folder instead of a shortcut using cmd



                          rd newestDir
                          for /f "tokens=*" %%a in ('dir /b /a:d /t:c /od') do set newest=%%a
                          mklink /J pathtonewestDir "%newest%"


                          or powershell



                          $newest = Get-ChildItem "pathtoroot" -Directory | Sort-Object CreationTime | Select-Object -Last 1
                          New-Item -Path pathtonewestDir -ItemType SymbolicLink -Value "$newest" -Force


                          The above commands will create a symlink named pathtonewestDir that points to the latest folder





                          If you open the folder from shells you can open it directly from command line instead of creating a shortcut and update it every day



                          With powershell you need only one line



                          start $(Get-ChildItem "pathtoroot" -Directory | Sort-Object CreationTime | Select-Object -Last 1)


                          You can change the last part to Sort-Object CreationTime -Descending | Select-Object -First 1, or shorten it to



                          start $(ls "pathtoroot" -dir | sort CreationTime | select -last 1)


                          In cmd you can use this



                          for /f "tokens=*" %%a in ('dir /b /a:d /t:c /od') do set newest=%%a
                          start %newest%


                          Alternatively this also work



                          for /f "tokens=*" %%a in ('dir /b /a:d /t:c /o:-d') do (start "" "%%a" & exit /B)


                          exit /B can also be changed to goto :eof






                          share|improve this answer















                          Explorer and the Windows' file open dialog support sorting the folder as Creation time, no script is needed. Although it'll just sort by modified date by default, you can select Sort by > More and choose the appropriate item. Once set, explorer will remember the sorting option and then every time you open it the latest one will always be at the top, no script is needed



                          You can also create a symlink to the latest folder instead of a shortcut using cmd



                          rd newestDir
                          for /f "tokens=*" %%a in ('dir /b /a:d /t:c /od') do set newest=%%a
                          mklink /J pathtonewestDir "%newest%"


                          or powershell



                          $newest = Get-ChildItem "pathtoroot" -Directory | Sort-Object CreationTime | Select-Object -Last 1
                          New-Item -Path pathtonewestDir -ItemType SymbolicLink -Value "$newest" -Force


                          The above commands will create a symlink named pathtonewestDir that points to the latest folder





                          If you open the folder from shells you can open it directly from command line instead of creating a shortcut and update it every day



                          With powershell you need only one line



                          start $(Get-ChildItem "pathtoroot" -Directory | Sort-Object CreationTime | Select-Object -Last 1)


                          You can change the last part to Sort-Object CreationTime -Descending | Select-Object -First 1, or shorten it to



                          start $(ls "pathtoroot" -dir | sort CreationTime | select -last 1)


                          In cmd you can use this



                          for /f "tokens=*" %%a in ('dir /b /a:d /t:c /od') do set newest=%%a
                          start %newest%


                          Alternatively this also work



                          for /f "tokens=*" %%a in ('dir /b /a:d /t:c /o:-d') do (start "" "%%a" & exit /B)


                          exit /B can also be changed to goto :eof







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Feb 7 at 0:26

























                          answered Feb 6 at 15:07









                          phuclvphuclv

                          9,98164093




                          9,98164093






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Super User!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1402227%2fis-it-possible-to-have-a-shortcut-to-newest-subfolder%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              How to reconfigure Docker Trusted Registry 2.x.x to use CEPH FS mount instead of NFS and other traditional...

                              is 'sed' thread safe

                              How to make a Squid Proxy server?