10-13-2012
See the man pages for opendir() and readdir().
This User Gave Thanks to JohnGraham For This Post:
10 More Discussions You Might Find Interesting
1. Solaris
I have created a file that has list of all the files I want to copy into another directory.Is there a way to do it?
Thanks In advance (4 Replies)
Discussion started by: shreethik
4 Replies
2. Shell Programming and Scripting
Hi All,
I need to create a file which contains the list of all the files present in that directory.
e.g.,
ls /export/home/user/*.dat > list_file.dat
but what i am getting is:
$ ls /export/home/user/*.dat > list_file.dat
/export/home/user/*.dat: No such file or directory
But I have... (1 Reply)
Discussion started by: pranavagarwal
1 Replies
3. UNIX for Dummies Questions & Answers
hello there
i want to creat a file that count how many files i have in the directory.
for this i use the command
find . -type f | wc -l > 1In1.myfile
the problem with this command is that it not update after i add a new file in the directory.
Anyone got any ideas how i can... (5 Replies)
Discussion started by: AntiPin
5 Replies
4. Shell Programming and Scripting
Hi,
I am trying to get the total file size for certain files per directory.
I am using
find /DirectoryPath -name '*.dta' -exec ls -l {} \; | awk '{ print $NF ": " $5 }' > /users/cergun/My\ Documents/dtafiles.txt
but this lists all the files in the directories.
I need the total... (9 Replies)
Discussion started by: cergun
9 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I need to copy files from one dir to another dir.
The list of filesnames to be moved are in a file called files2cp.log
Script:
#!/bin/ksh
exec 0</home/amdocs/files2cp.log
while read LINE
do
cp -i /iccs33/attach/"$LINE" /iccs30/attach/"$LINE"
done
The output is "No such... (6 Replies)
Discussion started by: srinirsr
6 Replies
6. Shell Programming and Scripting
Script must removes files from the first directory if there is a file with same name in the second directory
Script passed to the two directories, it lies with them in one directory:
sh script_name dir1 dir2
This is my version, but it does not work :wall:
set - $2/*
for i
do
set -... (6 Replies)
Discussion started by: SLAMUL
6 Replies
7. Shell Programming and Scripting
got it figured out :) (1 Reply)
Discussion started by: sHockz
1 Replies
8. Shell Programming and Scripting
I have two files
File 1 in reading directory is of following format
Read 1 A T
Read 3 T C
Read 5 G T
Read 7 A G
Read 10 A G
Read 12 C G
File 2 in directory contains
Read 5 A G
Read 6 T C
Read 7 G A
Read 8 G A
Read 20 A T
File2 contains (1 Reply)
Discussion started by: empyrean
1 Replies
9. Shell Programming and Scripting
I have a log file with contents like below.
Repository: https://someserver:9443/
Workspace: (1000) "test_scripts_ws"
Component: (1001) "some_Automated_Scripts"
Change sets:
(1002) ---$ john "test memory" 17-Sep-2014 02:24 PM
Changes:
--a--... (9 Replies)
Discussion started by: gaurav99
9 Replies
10. Shell Programming and Scripting
Given a directory containing say a few thousand files,
please output a list of all the names of the files in the directory that are exactly the same, i.e. have the same contents.
func(a_directory_name) output -> {“matches”: , ... ]}
e.g. func(“/home/my/files”) where the directory... (7 Replies)
Discussion started by: anuragpgtgerman
7 Replies
FOPEN(3S) FOPEN(3S)
NAME
fopen, freopen, fdopen - open a stream
SYNOPSIS
#include <stdio.h>
FILE *fopen(filename, type)
char *filename, *type;
FILE *freopen(filename, type, stream)
char *filename, *type;
FILE *stream;
FILE *fdopen(fildes, type)
char *type;
DESCRIPTION
Fopen opens the file named by filename and associates a stream with it. Fopen returns a pointer to be used to identify the stream in sub-
sequent operations.
Type is a character string having one of the following values:
"r" open for reading
"w" create for writing
"a" append: open for writing at end of file, or create for writing
In addition, each type may be followed by a "+" to have the file opened for reading and writing. "r+" positions the stream at the begin-
ning of the file, "w+" creates or truncates it, and "a+" positions it at the end. Both reads and writes may be used on read/write streams,
with the limitation that an fseek, rewind, or reading an end-of-file must be used between a read and a write or vice-versa.
Freopen substitutes the named file in place of the open stream. It returns the original value of stream. The original stream is closed.
Freopen is typically used to attach the preopened constant names, stdin, stdout, stderr, to specified files.
Fdopen associates a stream with a file descriptor obtained from open, dup, creat, or pipe(2). The type of the stream must agree with the
mode of the open file.
SEE ALSO
open(2), fclose(3)
DIAGNOSTICS
Fopen and freopen return the pointer NULL if filename cannot be accessed, if too many files are already open, or if other resources needed
cannot be allocated.
BUGS
Fdopen is not portable to systems other than UNIX.
The read/write types do not exist on all systems. Those systems without read/write modes will probably treat the type as if the "+" was
not present. These are unreliable in any event.
In order to support the same number of open files as does the system, fopen must allocate additional memory for data structures using cal-
loc after 20 files have been opened. This confuses some programs which use their own memory allocators. An undocumented routine, f_preal-
loc, may be called to force immediate allocation of all internal memory except for buffers.
4th Berkeley Distribution May 27, 1986 FOPEN(3S)