Skip to main content

I want to pipe file names to other programs, but they all choke when the names contain spaces.

Let's say I have a file called.

foo bar

How can I get findfind to return the correct name?

Obviously I want:

foo\ bar

or:

"foo bar"

EDITEDIT: I don't want to go through xargsxargs, I want to get a correctly formatted string out of findfind so that I can pipe the string of file names directly to another program.

I want to pipe file names to other programs, but they all choke when the names contain spaces.

Let's say I have a file called.

foo bar

How can I get find to return the correct name?

Obviously I want:

foo\ bar

or:

"foo bar"

EDIT: I don't want to go through xargs, I want to get a correctly formatted string out of find so that I can pipe the string of file names directly to another program.

I want to pipe file names to other programs, but they all choke when the names contain spaces.

Let's say I have a file called.

foo bar

How can I get find to return the correct name?

Obviously I want:

foo\ bar

or:

"foo bar"

EDIT: I don't want to go through xargs, I want to get a correctly formatted string out of find so that I can pipe the string of file names directly to another program.

added 171 characters in body
Source Link
bug
  • 2.7k
  • 6
  • 24
  • 23

I want to pipe file names to other programs, but they all choke when the names contain spaces.

Let's say I have a file called.

foo bar

How can I get find to return the correct name?

Obviously I want:

foo\ bar

or:

"foo bar"

EDIT: I don't want to go through xargs, I want to get a correctly formatted string out of find so that I can pipe the string of file names directly to another program.

I want to pipe file names to other programs, but they all choke when the names contain spaces.

Let's say I have a file called.

foo bar

How can I get find to return the correct name?

Obviously I want:

foo\ bar

or:

"foo bar"

I want to pipe file names to other programs, but they all choke when the names contain spaces.

Let's say I have a file called.

foo bar

How can I get find to return the correct name?

Obviously I want:

foo\ bar

or:

"foo bar"

EDIT: I don't want to go through xargs, I want to get a correctly formatted string out of find so that I can pipe the string of file names directly to another program.

Source Link
bug
  • 2.7k
  • 6
  • 24
  • 23

How do I use find when the filename contains spaces?

I want to pipe file names to other programs, but they all choke when the names contain spaces.

Let's say I have a file called.

foo bar

How can I get find to return the correct name?

Obviously I want:

foo\ bar

or:

"foo bar"