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.

1 Answers1

3

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

find .... -print0 | xargs -0 ...
NickD
  • 2,926