Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Help with directory management Post 48271 by Perderabo on Tuesday 2nd of March 2004 11:36:00 AM
Old 03-02-2004
Well you already know how to create a file called "bob". To copy "bob" to "jack", you would just open "bob" read the data and write it to a file called "jack".

The dirent.h supports routines called opendir, readdir, closedir, etc. The all have man pages and a command like "man opendir" will show you how to use them. But you don't need them here. They would be used to scan an entire directory. When you open "bob", the kernel scans the directory for you.

After you open "bob", you can use "stat()" to get the permissions on the file. And again stat has a man page.

Syntax-wise these are all just functions, there is nothing special about them.
 

9 More Discussions You Might Find Interesting

1. AIX

User Management

Can someone suggest me any means of having a controlled way to user access ... basically we have a varied environment of people(users) logging in to AIX boxes ... either via 1) telnet ... 2) application 3) databse (SQL's) what we need to do is formalise this .. can someone help me with this ... (2 Replies)
Discussion started by: rajesh_149
2 Replies

2. Programming

Need to know about Event Management

Hi I need to understand abt Event Management Library for example..A module will be responsible for Handling the event posted by the other modules...and creating a new process for handling the event posted by the other modules..also after completing the event clearing of the event... Need to... (3 Replies)
Discussion started by: nathgopi214
3 Replies

3. Shell Programming and Scripting

string management

I want to prompt for a full name, then select the surname from the full name. Then address the person as the surname entered in the fullname (1 Reply)
Discussion started by: orjnet
1 Replies

4. HP-UX

Software management HP/UX 9.00

Hello, all! I'm newbie in HP/UX and at my job I'm dealing with HP/UX 9.00. Due this OS is an old one, I couldn't find some info, concretely, about software management on it. Can you please help me? (5 Replies)
Discussion started by: Che_G
5 Replies

5. UNIX and Linux Applications

Password management / centralized password management

Hello all, I need help for build server call as Password management / centralized password management server. My situation and example: I have 600 server in my server room running on Linux then I need 1 server only can create login/password and then user can login to all 600 server no... (2 Replies)
Discussion started by: sheikh76
2 Replies

6. HP-UX

Patch Management

HI all, As per the audit policy, patch has to be apply periodically, but in my scenerio, it has been applied lastly in the year 2010. Using HP UX 11.11, 11.21 and 11.31 I would like to know, how to identify the patches which are need to update, what will be the procedure to update, how to... (5 Replies)
Discussion started by: selvaforum
5 Replies

7. IP Networking

IP Management

Hello all, I was wondering which way do you use to manage you IPs? For example in our case we have excel sheets and we export them in html first and import it to a server running apache, so to be visible from all. But i was wondering if there are any way (prefer a way running in web server)... (2 Replies)
Discussion started by: @dagio
2 Replies

8. UNIX for Advanced & Expert Users

Password management

You know those lists of "the most common passwords"? I was looking at one of those because I actually want to use a really common password or two on occasion. The thing is I'm skeptical that these are legitimate lists. Most things these days require at least 8 chars with a numeral. But these lists... (1 Reply)
Discussion started by: jutnobs
1 Replies

9. What is on Your Mind?

Individual Risk Management (Personal IT Security) and Browser Cache Management

Original post from this thread on browser caching. To add to this, it is an effective security measure to clear absolutely all cached data (cookies, web content, ....) when closing the browser - i.e. in case of a shutdown. It takes a bit of work to re-login to all the sites but websites will not... (7 Replies)
Discussion started by: bakunin
7 Replies
OPENDIR(3)						     Linux Programmer's Manual							OPENDIR(3)

NAME
opendir, fdopendir - open a directory SYNOPSIS
#include <sys/types.h> #include <dirent.h> DIR *opendir(const char *name); DIR *fdopendir(int fd); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): fdopendir(): Since glibc 2.10: _POSIX_C_SOURCE >= 200809L Before glibc 2.10: _GNU_SOURCE DESCRIPTION
The opendir() function opens a directory stream corresponding to the directory name, and returns a pointer to the directory stream. The stream is positioned at the first entry in the directory. The fdopendir() function is like opendir(), but returns a directory stream for the directory referred to by the open file descriptor fd. After a successful call to fdopendir(), fd is used internally by the implementation, and should not otherwise be used by the application. RETURN VALUE
The opendir() and fdopendir() functions return a pointer to the directory stream. On error, NULL is returned, and errno is set appropri- ately. ERRORS
EACCES Permission denied. EBADF fd is not a valid file descriptor opened for reading. EMFILE The per-process limit on the number of open file descriptors has been reached. ENFILE The system-wide limit on the total number of open files has been reached. ENOENT Directory does not exist, or name is an empty string. ENOMEM Insufficient memory to complete the operation. ENOTDIR name is not a directory. VERSIONS
fdopendir() is available in glibc since version 2.4. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +-----------------------+---------------+---------+ |Interface | Attribute | Value | +-----------------------+---------------+---------+ |opendir(), fdopendir() | Thread safety | MT-Safe | +-----------------------+---------------+---------+ CONFORMING TO
opendir() is present on SVr4, 4.3BSD, and specified in POSIX.1-2001. fdopendir() is specified in POSIX.1-2008. NOTES
Filename entries can be read from a directory stream using readdir(3). The underlying file descriptor of the directory stream can be obtained using dirfd(3). The opendir() function sets the close-on-exec flag for the file descriptor underlying the DIR *. The fdopendir() function leaves the set- ting of the close-on-exec flag unchanged for the file descriptor, fd. POSIX.1-200x leaves it unspecified whether a successful call to fdopendir() will set the close-on-exec flag for the file descriptor, fd. SEE ALSO
open(2), closedir(3), dirfd(3), readdir(3), rewinddir(3), scandir(3), seekdir(3), telldir(3) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2017-09-15 OPENDIR(3)
All times are GMT -4. The time now is 08:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy