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

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -