Question

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?

Was it helpful?

Solution

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

OTHER TIPS

find /path -name '*' -type f -exec dos2unix {} \;

dos2unix -k `find . -type f`
find . -type f -exec dos2unix -k '{}' \;
find . -type f -print | xargs dos2unix -k

Any of above command can be used from TOPDIR

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top