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 6701527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:56:41+00:00 2026-05-26T06:56:41+00:00

The program is supposed to find a file and return whether it exists on

  • 0

The program is supposed to find a file and return whether it exists on the system or not, now i have found that find command should be used, but since this command will be initiated by the code (using System) i need to save the results in a file, and trying on the terminal, i cannot get it to work, the result doesn’t appear in the file, i am trying:

find / -name 'test2abc' 2>/dev/null -> res

The file res is empty. How to do it right?

Also is there a better way to do it, i am supposed to print the details of the file using stat command if the file exists. Is there a way to use juts the stat command to search for the file in the subfolders as well?

  • 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-05-26T06:56:42+00:00Added an answer on May 26, 2026 at 6:56 am

    The -> res part should be > res only.

    If you try the command like this on the commandline:

    find / -name 'test2abc' -> res
    

    it will print an error:

    find: paths must precede expression: -
    

    The - is not part of any valid redirection and hence given to find which cannot interpret it either.

    It may be wise not to suppress error messages. A simple way can be redirecting both stderr and stdout to the file like this:

    find / -name 'test2abc' > res 2>&1
    

    Then the error about the - would have been in the file right from the start you you would have known what`s wrong very fast.

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

Sidebar

Related Questions

I have a program that is supposed to send a file to a web
I have a program that is supposed to interact with a web server and
I have a program for the iPhone that is supposed to be doing intelligent
I cannot find how I'm supposed to handle file opening in my program. For
Suppose I have one program that I compile and generate a preprocessed output file,
I am supposed to write a program in JavaScript to find all the anagrams
I am supposed to write a program that gets some PNG images from the
I have a Java program which generates a text file on a UNIX server.
Hi I have a small problem. I am coding a program that displays the
I had a question: Supposed I have a header/source file set and a header

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.