DIR(5) File Formats Manual DIR(5)NAME
dir - format of directories
SYNOPSIS
#include <sys/dir.h>
DESCRIPTION
A directory behaves exactly like an ordinary file, save that no user may write into a directory. The fact that a file is a directory is
indicated by a bit in the flag word of its i-node entry see, filsys(5). The structure of a directory entry as given in the include file
is:
By convention, the first two entries in each directory are for `.' and `..'. The first is an entry for the directory itself. The second
is for the parent directory. The meaning of `..' is modified for the root directory of the master file system and for the root directories
of removable file systems. In the first case, there is no parent, and in the second, the system does not permit off-device references.
Therefore in both cases `..' has the same meaning as `.'.
SEE ALSO filsys(5)DIR(5)
Check Out this Related Man Page
DIRECTORY(3) Library Functions Manual DIRECTORY(3)NAME
directory, opendir, readdir, rewinddir, closedir, telldir, seekdir - directory routines
SYNOPSIS
#include <sys/types.h>
#include <dirent.h>
DIR *opendir(const char *dirname)
struct dirent *readdir(DIR *dirp)
void rewinddir(DIR *dirp)
int closedir(DIR *dirp)
#define _MINIX 1
#include <sys/types.h>
#include <dirent.h>
long telldir(DIR *dirp)
int seekdir(DIR *dirp, long pos)
DESCRIPTION
These routines form a system independent interface to access directories.
Opendir() opens the directory dirname and returns a pointer to this open directory stream.
Readdir() reads one entry from the directory as a pointer to a structure containing the field d_name, a character array containing the
null-terminated name of the entry.
Rewinddir() allows the directory to be read again from the beginning.
Closedir() closes the directory and releases administrative data.
The Minix specific functions telldir() and seekdir() allow one to get the current position in the directory file and to return there later.
Seekdir() may only be called with a position returned by telldir() or 0 (rewind). These functions should not be used in portable programs.
SEE ALSO dir(5).
DIAGNOSTICS
Opendir() returns a null pointer if dirname can't be opened, or if it can't allocate enough memory for the DIR structure.
Readdir() returns null if there are no more directory entries or on error.
Closedir() and seekdir() returns 0 on success, -1 on error.
Telldir() returns -1 on error.
All of them set errno appropriately. Readdir() will only set errno on error, not on end-of-dir, so you should set errno to zero before-
hand, and check its value if readdir() returns null.
NOTES
The return value of readdir() needs to be copied before the next operation on the same directory if it is to be saved.
AUTHOR
Kees J. Bot (kjb@cs.vu.nl)
DIRECTORY(3)
Basically i have done created the script below, and it functions ok, it prints the access rights the user has. But i need it to print the group permissions, and other permissions, it would also be helpful if i could print the permissions in numeric form aswell, if it is possible. I have looked in... (50 Replies)
I have 20 files in a direcotry like BARE01_DLY_MKT_YYYYMMDD. The MKT differes for all these files but the remaining syntax remains the same for a particular day. If I am checking for today I need to make sure that there are 20 files that start with BARE01_DLY_MKT_20060720. How can I write a... (31 Replies)
hey guys. i'm new to shell scripting but not new to programming. i want to write a script that will take all the files in the current directory that end with a particular filetype and change all their names to a number in order. so, it would take all the jpg files and sort them in alphabetical... (30 Replies)
Every day i ftp tar.gz a file from the production server to a back up machine.. This task creates way to much traffic on the network at the end of the day and puts and undo load on the production machine during operation hours. i would like to create a script that would automatically fire off the... (36 Replies)
All, I have a cleanup script that removes directories and all contents underneath, but I am having issues with directories with spaces.
This is the command I am currently running, how can I get it to work with directories with spaces?
find /path -mindepth 3 -type d -exec rm -rf {} \; (29 Replies)
dear all.
how can i copy a list of files with different names into others directory have the same name
like i have 3 files
10_10
10_10_11
10_10_11_12
and i have 3 directories
10_10
10_10_11
10_10_11_12
how can i make a loop to cp this files into the directory have the same name like... (31 Replies)
Let's say someone accidentally renamed the lib directory in Solaris 8, and now they cannot get into the terminal or even rename the folder via file manager.What would one do? (37 Replies)
Hello,
When listing the file systems (using ls -ltr) , if the group names are longer the group name is getting truncated.
Can someone help with the script which would display the truncated group name?
I appreciate if someone could help in this regard. (45 Replies)
Hello everyone, finally made these commands working, but I don't know how ti implement the history command for this utility? Anyone? Please please (28 Replies)
Hi,
I try to list all files in a folder, including all the subdirs (and their subdirs) and all files contained in each of these folders. I then print it to a simple txt file.
I use ls -R -1 >test.txt
This sort of does what I need, yet, the result is something like:
It reasonably comes... (53 Replies)
Hi ,
Can you please check this code .I am getting the follwing error while executing the script.
Please help me out.
#rm /tmp/$$
#!/bin/ksh
dir_one="/usr/bin/sou"
dir_two="usr/bin/sou/temp"
for files in $dir_one/*.txt
do ... (31 Replies)
I have a function in bash script to create dir and subdir
function mkdir_stage ( )
{
mkdir -p /webdata/ecif/etl/$Env/$projectname/
mkdir -p /webdata/ecif/etl/$Env/$projectname/archivefiles
mkdir -p /webdata/ecif/etl/$Env/$projectname/dropbox
mkdir -p ... (40 Replies)
Hi all,
I need a script to delete a large set of files from a directory under / based on an input file and want to redirect errors into separate file.
I have already prepared a list of files in the input file.
Kndly help me.
Thanks,
Prash (36 Replies)
I am trying to find the home directory of users on a UNIX (Solaris/AIX) box using
echo ~usernameThis does return the home directory for all valid users. For some reason this command also outputs home directory which are non-existent for few users who seem not to have logon access to that... (31 Replies)
Hi Guys
I am trying to move file containing more than two - at the 3rd line of each files to a new directory. The files are something like this :
****** Text ******
/text/
text text
I want to make sure the search effect only take place on the 3rd line one as there might me... (46 Replies)