Reputation: 3267
I'm using Linux. I have a directory tree with over 100,000 files that originated on a MS Windows system. Some of the files have spaces in their names. I want to convert those files to unix. I ran this command
find . -type f | xargs -0 dos2unix
And received this error message
xargs: argument line too long
How can I fix this?
Upvotes: 1
Views: 1465
Reputation: 13189
You don't need xargs here, you can do
find . -type f -exec dos2unix '{}' +
Upvotes: 2
Reputation: 8963
If you want to use xargs
with -0
to prevent issues with spaces/special characters in file names you must also use -print0
with find
so it will delimit its output with null bytes:
find . -type f -print0 | xargs -0 dos2unix
Upvotes: 4