Hi ,
I need a shell script which basicaly moves all the files from one folder say folder x to folder y and once they are moved to folder y a datetimestamp should be attached to there name
for ex
file a should be moved to y folder and renamed as a_20081015 (1 Reply)
i have created file in one of the folders on unix
UNIX 's36tou -T XYZ /tmp/p400/dataout/ias/AB >/dev/null
I am using above command to copy file from one system to unix
XYZ is name of file on my system usually this name is very big so i use -T to trim some charaters from name.
noe... (1 Reply)
Hi,
I need to move 1000s of files from one folder to another.
Actually there are 100K+ files.
Source dir : source1
Target dir : target1
Now if try cp or mv commands I am getting an error message : Argument List too long.
I tried to do it by the time the files are created in the source... (6 Replies)
Hi ,
Please help with the following questions
1) how can i find size of a file ? i have written du -k $flname > s1 . Is this right ?
Any other better suggeastions ?
2) how do I use mv command for moving the file ? I need the syntax with some examples
3) Command for printing the total... (1 Reply)
Hi Experts,
I have a "Source" folder which may contain some files. I need a shell script which should move all files which are older than 3 days to "Archive" folder.
Thanks in Advance... (4 Replies)
Hi All,
I have multiple files in the folder, I want to move those files into the other folder on based of name
File names:
Template_server1_01==>
Template_server1_02==>To one directory /Server1
Template_server1_03==>
Template_server2_01==>
Template_server2_02==>To one... (9 Replies)
There are files stored like 14.Aug.2014.log, 15.Aug.2014.log etc. in a folder $HOME/logyou need to find out all the log files of last 1 month and move them into $HOME/logs/lastmonth/
this should be implemented with reference of file name.
---------- Post updated at 12:30 PM ----------... (3 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
There are files stored like 14.Aug.2014.log, 15.Aug.2014.log etc. in a folder $HOME/log you need to find out all... (4 Replies)
I need help to write shell script to copy files from one server to another server.
Source Directory UAE(inside i have another folder Misc with files inside UAE folder).I have to copy this to another server UAE folder( Files should be copied to UAE folder and Misc files should be copied in target... (3 Replies)
Discussion started by: naresh2389
3 Replies
LEARN ABOUT BSD
readdir
DIRECTORY(3) Library Functions Manual DIRECTORY(3)NAME
opendir, readdir, telldir, seekdir, rewinddir, closedir - directory operations
SYNOPSIS
#include <sys/types.h>
#include <sys/dir.h>
DIR *opendir(filename)
char *filename;
struct direct *readdir(dirp)
DIR *dirp;
long telldir(dirp)
DIR *dirp;
seekdir(dirp, loc)
DIR *dirp;
long loc;
rewinddir(dirp)
DIR *dirp;
closedir(dirp)
DIR *dirp;
DESCRIPTION
Opendir opens the directory named by filename and associates a directory stream with it. Opendir returns a pointer to be used to identify
the directory stream in subsequent operations. The pointer NULL is returned if filename cannot be accessed, or if it cannot malloc(3)
enough memory to hold the whole thing.
Readdir returns a pointer to the next directory entry. It returns NULL upon reaching the end of the directory or detecting an invalid
seekdir operation.
Telldir returns the current location associated with the named directory stream.
Seekdir sets the position of the next readdir operation on the directory stream. The new position reverts to the one associated with the
directory stream when the telldir operation was performed. Values returned by telldir are good only for the lifetime of the DIR pointer
from which they are derived. If the directory is closed and then reopened, the telldir value may be invalidated due to undetected direc-
tory compaction. It is safe to use a previous telldir value immediately after a call to opendir and before any calls to readdir.
Rewinddir resets the position of the named directory stream to the beginning of the directory.
Closedir closes the named directory stream and frees the structure associated with the DIR pointer.
Sample code which searchs a directory for entry ``name'' is:
len = strlen(name);
dirp = opendir(".");
for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp))
if (dp->d_namlen == len && !strcmp(dp->d_name, name)) {
closedir(dirp);
return FOUND;
}
closedir(dirp);
return NOT_FOUND;
SEE ALSO open(2), close(2), read(2), lseek(2), dir(5)4.2 Berkeley Distribution September 24, 1985 DIRECTORY(3)