473,785 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

find utility like system call in unix

hi

is there any system call in unix that will search for a file in the
filesystem.
someting like the find utility.

if not then how should i search for a file in the file system.
heard of system call by name opendir and readdir - is the how it should
be done.
tx.

Apr 21 '06 #1
3 3801
Ico
rr********@gmai l.com wrote:

is there any system call in unix that will search for a file in the
filesystem. someting like the find utility.
A newsgroup discussing unix would probably be a better place to ask this
question. iirc, there is no such function call in any of the unixes I
know, but there might be in other flavours.
if not then how should i search for a file in the file system. heard
of system call by name opendir and readdir - is the how it should be
done.
Yes, with unix these functions are probably the way to go. Think
'recursion'. The find utility probably relies on those functions as
well. Note that these functions are defined by Posix, and not part of
standard ANSI C.
tx.


tx ?
--
:wq
^X^Cy^K^X^C^C^C ^C
Apr 21 '06 #2
In article <44************ ***********@dre ader18.news.xs4 all.nl>,
Ico <us****@zevv.nl > wrote:
is there any system call in unix that will search for a file in the
filesystem. someting like the find utility.
A newsgroup discussing unix would probably be a better place to ask this
question. iirc, there is no such function call in any of the unixes I
know, but there might be in other flavours.


Some unixes have a function "ftw" or functions with names beginning
"fts" that do this sort of thing. According to one manual page, "the
fts utility is expected to be included in a future IEEE Std
1003.1-1988 (POSIX.1) revision", so you might look for a Posix-related
group or web site.

-- Richard
Apr 21 '06 #3
rr********@gmai l.com wrote:
# hi
#
# is there any system call in unix that will search for a file in the
# filesystem.
# someting like the find utility.

You can do most any command line with something like
system("find /usr/local -name '*mysql*' >find-output");
FILE *f = fopen("find-output","r");
...
fclose(f);

If you're willing to restrict yourself to Posix, you can do something like
FILE *f = popen("find /usr/local -name '*mysql*' >find-output","r");
...
pclose(f);

--
SM Ryan http://www.rawbw.com/~wyrmwif/
This is one wacky game show.
Apr 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
14413
by: Ayesha Ahsan | last post by:
Hi, I use Runtime.getRuntime().exec(command) to make my system call. For Windows based Dos, i add "cmd /c" before I type in my system call. So for example make the system call "dir": String command="cmd /c dir"; Runtime.getRuntime().exec(command); What is the equivalenr of cmd /c in Unix .
0
1409
by: Oleg Paraschenko | last post by:
Hello, might be of some interest: find with XPath over file system http://uucode.com/texts/xfind/index.html <quote> The standard UNIX utility find now supports XPath:
0
1330
by: darknessfish | last post by:
Ok, I'm trying to write a basic scp scheduler, which will occasionally scan a directory, and use cygwin's scp.exe to copy the files to a Unix box. After various problems, the set up I've got now is this: A Console application, which accepts the file as a parameter, and launches the scp utility via the Process.Start() command. If I call this Console from a command line, or from a dos-prompt, the file transfers correctly, without need of...
12
3456
by: jrefactors | last post by:
If the C programs have UNIX system calls such as fork(), alarm(), etc.., we should call it UNIX programs, not traditional C programs? We couldn't compile the programs with system calls using VC++ compiler. I need to compile it under UNIX platform. correct? any other alternatives?? Please advise. Thanks!!
2
4546
by: Xah Lee | last post by:
Python Doc Problem Example: os.system Xah Lee, 2005-09 today i'm trying to use Python to call shell commands. e.g. in Perl something like output=qx(ls) in Python i quickly located the the function due to its
7
7586
by: Xie Qing | last post by:
Hi all, Is there a tool or view to display the status of a Load utility job on windows or Unix(say loading few million rows into a table)? I understand in OS/390 there is a dis utility to show the status of the utility. Is it also possible in UDB? I'm using UDB 8.1 on windows 2000. Thanks for your time.
5
3547
by: markus | last post by:
Hi, I have a question that deals with the standard c library VS (Unix) system calls. The question is: which header files (and functions) are part of the C library and which header files (and function calls) are part of the (Unix) system calls. The cause of my confusion is that for example stdio.h is considered
7
6956
by: rahul8143 | last post by:
hello, what is difference between system call and library function call? Does library function call can have context switch to kernel mode? regards, rahul
9
13651
by: emagzz | last post by:
Hi all, I need to convert many text file from ANSI to UNICODE. Some body knows if there is a free utility that can do this from the command line so as I can use it inside a batch file. Thank you Emanuele
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10153
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10093
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2880
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.