Running dos2unix on a list of files

Hi,

I have a directory structure, with loads of files in. I can find all the files simply by doing

find ./ -type file -name "*" -print

However, I then want to run dos2unix on each of these files, and preserve the original name. For example

dos2unix dave dave

Any ideas on how to do this as a one liner, or a few lines?

Thanks

Alistair
Alistair_WilliamsAsked:
Who is Participating?
 
griesshConnect With a Mentor Commented:
Hi Alistair_Williams,

 find ./ -type file -name "*" -print | xargs dos2unix


======
Werner
0
 
Magic55Commented:
find . -type f -name "*" | xargs dos2unix
/ TK
0
 
liddlerCommented:
Slightly simpler
find . -type f -exec dos2unix {} \;
You don't need the -name and using find's exec option is more efficient than passing to xargs
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.