Created
          November 7, 2022 18:48 
        
      - 
      
 - 
        
Save tayiorbeii/c6407ed88ba665f23a7f95a2f60b4d85 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import "@johnlindquist/kit" | |
| let replaceAll = await npm('just-replace-all') | |
| // Name: renumber-filenames-by-one | |
| // Author: Taylor Bell | |
| // Description: Add one to the numbered filenames dropped in | |
| let files = await drop() | |
| for (let f of files) { | |
| let num = parseInt(f.name.match(/^[0-9]+/)[0]) | |
| let newName = replaceAll(f.name, `${num}`, `${num+1}`) | |
| await exec(`mv "${f.path}" "${f.path.split(f.name)[0]}${newName}"`) | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment