Please help - I need to copy a single file to multiple directories.
Dir structure:
Parent_Directoy
Filename1
Child_Directory1
Child_Directory2
Child_Directory3
Child_Directory4
....
So I need to copy Filename1 to all of the... (2 Replies)
Hello all,
Here's the deal...I have one directory with many subdirs and files.
What I want to find out is who is keeping old files and directories...say files and dirs that they didn't use since a number of n days, only one level under the initial dir. Output to a file.
A script for... (5 Replies)
Hi, I am fairly new to unix, and am trying to copy all files with the name "*.cons" within a directory (and all of the many directories within it) to a new directory called "output". There are multiple nested directories, and I would like to just pull out the files with ".cons" and not the other... (5 Replies)
Hi all,
Using grep command, i want to find the pattern of text in all directories and sub-directories.
e.g: if i want to search for a pattern named "parmeter", i used the command
grep -i "param" ../*
is this correct? (1 Reply)
Hi All Genious,
I want to copy a file name XYZ .In a directory /HOME/dir/IXOS1/dir1
which contain multiple directories named not in pattern want to copy the XYZ in all of the directories available on path /HOME/dir/IXOS1/dir1 .
Thanks in advance . (2 Replies)
I have directory path in which there are several sub directories. In all these sub dir there will be one env.cnf file. I want to copy this env.cnf file from
each sub dir's and place them in destination path by creating same filename as sub dir_env.cnf.
After copying env.cnf files from source... (4 Replies)
I was trying to copy the files inside the path /home/user/check/Q1/dir/folder1/expected/n/a1.out1 and a1.out2 and a1.out3 to /home/user/check/Q2/dir/folder1/expected/n/
if n directory is not present at Q2/dir/folder1/expected/ then directory should be created first. And, script follow the... (5 Replies)
I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. This is for Solaris. Please help. (1 Reply)
Discussion started by: blinkingdan
1 Replies
LEARN ABOUT OSF1
alphasort
scandir(3) Library Functions Manual scandir(3)NAME
scandir, alphasort - Scans or sorts directory contents
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <sys/types.h> #include <sys/dir.h>
int scandir ( char *dir_name, struct dirent * (*name_list[ ]), int (*select) ( struct dirent *dir ), int (*compare) (
struct dirent **dir1, struct dirent **dir2 ) );
int alphasort ( struct dirent **dir1, struct dirent **dir2 );
PARAMETERS
Points to the directory name. Points to the array of pointers to directory entries. Points to a user-supplied function that is called by
the scandir() function to select which entries to include in the array. Points to a user-supplied function that sorts the completed
array. Points to a dirent structure. Points to a dirent structure.
DESCRIPTION
The scandir() function reads the directory pointed to by the dir_name parameter. It then uses the malloc() function to create an array of
pointers to directory entries. The scandir() function returns the number of entries in the array and, through the name_list parameter, a
pointer to the array.
The select parameter points to a user-supplied function that the scandir() function calls to select which entries to include in the array.
The selection routine is passed a pointer to a directory entry and returns a nonzero value for a directory entry that is included in the
array. If the select parameter is a null value, all directory entries are included.
The compare parameter points to a user-supplied function that is passed to the qsort() function to sort the completed array. If the compare
parameter is a null value, the array is not sorted.
The memory allocated to the array can be deallocated by freeing each pointer in the array, and the array itself, with the free() function.
The alphasort() function alphabetically compares the two dirent structures pointed to by the dir1 and dir2 parameters. This function can be
passed as the compare parameter to either the scandir() function or the qsort() function. A user-supplied subroutine may also be used.
RETURN VALUES
The scandir() function returns -1 if the directory cannot be opened for reading or if the malloc() function cannot allocate enough memory
to hold all the data structures. If successful, the scandir() function returns the number of entries found.
The alphasort() function returns the following values: Less than 0 (zero): The dirent structure pointed to by the dir1 parameter is lexi-
cally less than the dirent structure pointed to by the dir2 parameter. 0 (zero): The dirent structures pointed to by the dir1 parameter
and the dir2 parameter are equal. Greater than 0 (zero): The dirent structure pointed to by the dir1 parameter is lexically greater than
the dirent structure pointed to by the dir2 parameter.
RELATED INFORMATION
Functions: malloc(3), opendir(3), qsort(3) delim off
scandir(3)