title: Create Shortcut based on the order of files
body: <p>I wonder how to make a shortcut based on the next name in the file list in alphabetical order.</p>
  
  <pre><code>Folder:
  
  C:\Series
  
  Season01 - Ep01.avi
  Season01 - Ep02.avi
  Season02 - Ep01.avi
  Season02 - Ep02.avi
  Season03 - Ep01.avi
  Season04 - Ep01.avi
  
  Desktop:
  
  Season01 - Ep02.lnk
  </code></pre>
  
  <p>When opening the file it deletes the shortcut <strong>Season01 - Ep02.lnk</strong> and create a new shortcut to <strong>Season03 - Ep01.lnk</strong> and so on.</p>
  
  <p>@Edit</p>
  
  <p>As I was asked, here is my super incomplete code.</p>
  
  <pre><code>Sub Main()
  
  Set wsc = CreateObject("WScript.Shell")
  Set Shell = CreateObject("WScript.Shell")
  Set fso = WScript.CreateObject("Scripting.FileSystemObject")
  
  Const ForReading = 1, ForWriting = 2, ForAppending = 8, CreateIfNeeded = True
  
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  
  Set objTextFile = objFSO.OpenTextFile("Local.ini", ForReading)
  
  For i = 4 to 3
      objTextFile.ReadLine
  Next
  
  strLine = objTextFile.ReadLine
  
  Set objTextFile = objFSO.OpenTextFile("Episode.ini", ForReading)
  
  For i = 4 to 3
      objTextFile.ReadLine
  Next
  
  strLine2 = objTextFile.ReadLine
  
  Set objTextFile = objFSO.OpenTextFile("Season.ini", ForReading)
  
  For i = 4 to 3
      objTextFile.ReadLine
  Next
  
  strLine3 = objTextFile.ReadLine
  DesktopPath = Shell.SpecialFolders("Desktop")
  
  
  If (fso.FileExists(wsc.SpecialFolders("desktop") &amp; "\Season01 - Ep01.lnk")) Then
  
  Set link = Shell.CreateShortcut(DesktopPath &amp; "\Season"&amp; strLine3--01 &amp;" - Ep" &amp; strLine2--01 &amp; ".lnk")
  link.Description = "Episode"
  link.Arguments = ""
  link.TargetPath = strLine &amp; "\Season"&amp; strLine3--01 &amp;" - Ep"&amp; strLine2--01 &amp;".rmvb"
  link.WindowStyle = 1
  link.IconLocation = strLine &amp; "\Season"&amp; strLine3--01 &amp;" - Ep"&amp; strLine2--01 &amp;".rmvb"
  link.HotKey = ""
  link.WorkingDirectory = strLine
  link.Save
  
  strAtalho = "Season"&amp; strLine3-01 &amp;" - Ep"&amp; strLine2-01 &amp;".rmvb"
  Set objShell = CreateObject("WScript.Shell") 
  objDesktop = objShell.SpecialFolders("Desktop") 
  Set objFSO = CreateObject("Scripting.FileSystemObject") 
  objFSO.DeleteFile(objDesktop &amp; "\" &amp; strAtalho)
  
    WScript.Quit()
  
  Else
  
  End If
  
    WScript.Quit()
  
  End Sub 
  
  On Error Resume Next
    Main
    If Err.Number Then
       WScript.Quit 4711
    End If
  </code></pre>
  
  <p><strong>-</strong></p>
  
  <blockquote>
    <p>Inside archives:</p>
    
    <p>Episode.ini</p>
    
    <p>01</p>
    
    <p>Season.ini</p>
    
    <p>01</p>
    
    <p>Local.ini</p>
    
    <p>C:\Series</p>
  </blockquote>
  
  <p>The code has several problems, as no change of season automatically, as not add 0 when you have unique numbers as 1, 2, 3, 4, 5, 6, 7, 8, 9, not verify that the file that will be created shortcut does not exist...</p>