Forest Notes

Tips, tricks, cheatsheets


Project maintained by iamzaychik Hosted on GitHub Pages — Theme by mattgraham

Ubuntu Rename files with regexp

2019-04-22


Lets change spaces to underscores:

  1. Install rename, if you not had it yet:
    $ sudo apt install rename
    
  2. Rename directories first:
    $ find -name "* *" -type d | rename 's/ /_/g'
    
  3. Rename files:
    $ find -name "* *" -type f | rename 's/ /_/g'
    

Source