How to rename all files and folder containing underscore to hyphen in Linux -


i want rename files , folder containing underscore in name , replace underscore hyphen.

currently using following code,

rename '_' '-' */*/*

it working showing me "argument list long"

you can try this:

$ tree foo foo ├── dir_1 │   └── foo_file_2 └── file_1  1 directory, 2 files $ ft in d f; find foo -type $ft -execdir sh -c 'mv "$0" "${0//_/-}"' {} \; ; done 2>/dev/null $ tree foo foo ├── dir-1 │   └── foo-file-2 └── file-1  1 directory, 2 files 

this renames directories , files (the for loop on d f) because haven't been able make renaming in 1 iteration.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -