Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8382253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:53:18+00:00 2026-06-09T16:53:18+00:00

I think this is gonna close to work find /mydirectory -name ‘*’ | xargs

  • 0

I think this is gonna close to work

find /mydirectory -name '*'  | xargs echo abc >

But I got:

find: paths must precede expression: b

Need a little help 🙂
thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T16:53:19+00:00Added an answer on June 9, 2026 at 4:53 pm

    Try this

    find . -type f -exec sh -c 'echo "abc" >> ${1}' _ "{}" \;
    

    Or if you want to do it in bulk:

    find . -type f -exec sh -c 'for f; do echo "abc" >> $f; done' _ "{}" +
    

    If you need explanations, ask.

    This page is a good guide on how to use find.

    In both commands, the _ and {} are passed as arguments to the sh command. Because $0 isn’t fully reliable to use (see the linked page), a dummy variable _ is passed to it.

    Find puts its matches in {}, which is expanded. So if the command matches a file a, then {} is expanded to a in the first command.

    In the first command, the command you are passing to exec is terminated with ;, but ; is special to the shell, so you escape it.

    The second command runs as a bulk operation, so if find matches a, b, and c (etc.), the {} is expanded to all three and passed in.

    Thus, you need a for f in the second command, which defaults to for f in $@, which will be your a, b, and c (and this can be tested by doing ${1}, ${2}, ${3}…).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think this could be a very easy question for you. But I have
(I think this is a pretty basic question on OOP, but unfortunately I wasn't
I think this is a pretty straightforward problem but... var outerHeight = $('.profile').outerHeight(); $(#total-height).text(outerHeight
I think this is mostly because I'm new to PHP OOP, but I have
I think this question has been asked many a times but I've been searching
I think this is an overly easy question but my brain is failing to
This is the last thing I'm gonna do, after I can make this work,
I think this is easily explained by looking at code, so I'm posting a
I think this is a simple and a silly question. I have included a
I think this is nearly impossible or very tricky. I'm using CriteriaBuilder, JPA 2.0,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.