Search code examples
linuxbashshelldos2unix

How to convert some files from dos format to unix


I know how to change file format from dos to unix by use dos2unix, but how can I change ALL the files will under a directory tree. Can dos2unix change files recursively?

for example, I have some files like following:

TOPDIR
|
+-----dir1
|      |
|      +---file1,file2, file3
|
+-----dir2
       |
       +---file4,file5

How can I change them in one time, or use some shell scripts?


Solution

  • better to do find /path -type -f -exec dos2unix '{}' \;