0

I'm trying to run join a bunch of files using the find command.

I have determined that filenames containing spaces are giving me a problem.

The following comand works for files that do not contain any spaces but fails when the filename contains a space.

  find /media/primary/acronis_ntfs/flickr_01/. -type f -name '*.*' | xargs cat > /media/primary/acronis_ntfs/flickr_01.txt

I have tried different commands as well - all with the same results.

  find /media/primary/acronis_ntfs/flickr_01/. -type f | xargs cat > /media/primary/acronis_ntfs/flickr_01.txt

If I go directly into the folder and run

  cat * > flickr_01.txt

It works - spaces and all.

I'm running ubuntu 16.10.

Any suggestions?

I'm losing my hair over something I thought is simple.

marked as duplicate by Gilles find Dec 10 '17 at 5:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

Make find use a NUL as the separator between filenames and tell xargs to look for same:

find .... -print0 | xargs -0 ...

Not the answer you're looking for? Browse other questions tagged or ask your own question.