@ Dahu: your solution is incorrect:
will return non-zero even if $file exists in one of the dirs (but doesn't in the other). You are also missing keyword 'in' in the for loop.
You're right, that why I said untested , I usually test my scripts before posting but this time I was in an hurry
Sir
From a unix machine some folders and their folders have to be copied to windows XP PC. Please help me with a batch file or a shell script. I am new to the the shell and batch files. Thanks in anticipation.
sastry (3 Replies)
Hi,
I am new to unix shell programming.
I want to write a shell script for a functionality existing in mainframe system.
I have one file as below as input
123456
&__987
&12yuq
abcdef
_ referes to blank
condition:whenever the input file is having &__ ,it should be replaced... (4 Replies)
Hi
I want to copy the structure from one place to another.
-> cd /hol/;
-> find . -type d | cpio -pvdm /abc/cat;
while copying the structure I want to exclude some directories like test1 and Test.
I have read somewhere that this can be done with -prune option.
Could anyone... (2 Replies)
hi
i have an input file that contains some thing like this
aaa acc aa abc1 1232 aaa abc2....
poo awq aa abc1 aaa aaa abc2
bbb bcc bb abc1 3214 bbb abc3....
bab bbc bz abc1 3214 bbb abc3....
vvv ssa as abc1 o09 aaa abc4....
azx aaq aa abc1 900 aqq abc19....
aaa aa aaaa abc1 899 aa... (8 Replies)
HI All
I have one master folder : ABCXYZ
I have sub folder in there :
AB
XY
AZ
AC
PR
AL
Now i want to copy AB , PR ,AL in to one new folder and zip it with time stamp.
like
Pre_02192013_12_32.zip
Zip folder should be in master folder. (2 Replies)
I have a folder like this
ls input1
dir1 dir2 dir3 file1 file2 file3
dir1, dir2 and dir3 are sub-folders inside the folder input1
ls input2
dir1 dir2 dir3 file1 file2 file3
My dir1 in input1 folder has files f1, f2, f3 and f4.
My dir1 in input2 folder has file f4 and f5.
... (3 Replies)
Hi,
Below is the listing of folder "greece"
$ cd greece
$ ls
tmp
server
logs
properties
I wish to copy all the contents of the dir "greece" to /tmp except the below three folders and its contents under "greece"
1.logs
2.server/bin/logs
3. server/cacheI am using sh (normal C... (4 Replies)
Dear All,
I will appreciate any help received. Our system is running on hpux v1
My problem is as follows:
We have many customer folders with name fd000100, fd000101 and so on
e.g.
(Testrun)(testsqa):/>ll /TESTrun/fd000100
total 48
drwxrwx--- 2 fq000100 test 96 Jun 27 2004... (17 Replies)
Hi guys,
Don't really know much about unix or anything, just starting to mess around a little bit to have more understanding in general.
So, I tried using rsync to copy my macbook pro backup/clone from an external drive I have to another external drive. I ended up using...
"sudo rsync -a... (1 Reply)
Hi,
So i know we use cp -r as a basic to copy folders/files.
I would like this BUT i would like to show the output of the files being copied.
With the amazing knowledge i have i have gone as far as this:
1) find source/* -exec cp -r {} target/ \;
2) for ObjectToBeCopied in `find... (6 Replies)
Discussion started by: Imre
6 Replies
LEARN ABOUT OPENDARWIN
link
LINK(2) BSD System Calls Manual LINK(2)NAME
link -- make a hard file link
SYNOPSIS
#include <unistd.h>
int
link(const char *name1, const char *name2);
DESCRIPTION
The link() function call atomically creates the specified directory entry (hard link) name2 with the attributes of the underlying object
pointed at by name1 If the link is successful: the link count of the underlying object is incremented; name1 and name2 share equal access and
rights to the underlying object.
If name1 is removed, the file name2 is not deleted and the link count of the underlying object is decremented.
Name1 must exist for the hard link to succeed and both name1 and name2 must be in the same file system. As mandated by POSIX.1 name1 may not
be a directory.
RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.
ERRORS
Link() will fail and no link will be created if:
[ENOTDIR] A component of either path prefix is not a directory.
[ENAMETOOLONG] A component of a pathname exceeded {NAME_MAX} characters, or an entire path name exceeded {PATH_MAX} characters.
[ENOENT] A component of either path prefix does not exist.
[EACCES] A component of either path prefix denies search permission.
[EACCES] The requested link requires writing in a directory with a mode that denies write permission.
[ELOOP] Too many symbolic links were encountered in translating one of the pathnames.
[ENOENT] The file named by name1 does not exist.
[EEXIST] The link named by name2 does exist.
[EPERM] The file named by name1 is a directory.
[EXDEV] The link named by name2 and the file named by name1 are on different file systems.
[ENOSPC] The directory in which the entry for the new link is being placed cannot be extended because there is no space left on the
file system containing the directory.
[EDQUOT] The directory in which the entry for the new link is being placed cannot be extended because the user's quota of disk
blocks on the file system containing the directory has been exhausted.
[EIO] An I/O error occurred while reading from or writing to the file system to make the directory entry.
[EROFS] The requested link requires writing in a directory on a read-only file system.
[EFAULT] One of the pathnames specified is outside the process's allocated address space.
SEE ALSO symlink(2), unlink(2)STANDARDS
The link() function is expected to conform to IEEE Std 1003.1-1988 (``POSIX.1'').
4th Berkeley Distribution January 12, 1994 4th Berkeley Distribution