Hi. Can somebody tell me if there's a way of creating a symbolic link from a directory on one filesystem to that on another that will allow a find command that doesn't use the -L param to locate a particular file under that new 'linked' dir. With a normal sym link the find command on that filesystem won't list the specified file ... unless I use
Many thanks
Last edited by user052009; 05-07-2017 at 08:36 PM..
If you create another (second) inode - not a symlink (a hard link) - then it will work.
Use the ln command -this has one limitation for the new hard link : the file has to be in the same file system as the original. That usually means the same mount point with no intervening mount points. From my man page:
DESCRIPTION
In the 1st form, create a link to TARGET with the name LINK_NAME. In
the 2nd form, create a link to TARGET in the current directory. In the
3rd and 4th forms, create links to each TARGET in DIRECTORY. Create
hard links by default, symbolic links with --symbolic. By default,
each destination (name of new link) should not already exist. When
creating hard links, each TARGET must exist. Symbolic links can hold
arbitrary text; if later resolved, a relative link is interpreted in
relation to its parent directory.
Be careful doing this - lots of hard links use up the inode quota for the file system. Bad things happen at that point.
Thanks Jim. Unfortunately I get the following error when trying to create a hard link:
Invalid cross-device link
---------- Post updated at 02:26 AM ---------- Previous update was at 02:24 AM ----------
Quote:
Originally Posted by MadeInGermany
If the start directory /u04 is a symlink then find -H /u04 ... will follow it, but not other symlinks.
Thanks also but the find cmd doesn't have a -L or a -H and I can't change the cmd in this instance so I need a work around with the link creation. Although none may be possible.
---------- Post updated at 02:30 AM ---------- Previous update was at 02:26 AM ----------
Quote:
Originally Posted by RudiC
Sure that works across file systems?
Yes it's just a normal ln -s link from a dir on one file system to that on another on the same host. A find cmd won't list any file under that link without an additional param like -L. Would just like to know if I can change the link in some way (rather than the find cmd) to get this to work. Thanks.
If you create another (second) inode - not a symlink (a hard link) - then it will work.
Use the ln command -this has one limitation for the new hard link : the file has to be in the same file system as the original. That usually means the same mount point with no intervening mount points. From my man page:
Be careful doing this - lots of hard links use up the inode quota for the file system. Bad things happen at that point.
Hi Jim,
No. No matter how many hard links there are to a file, that file only consumes one i-node.
If you have a bunch of symbolic links pointing to a regular file, the regular file and each symlink will consume separate i-nodes; but even if there are a 1000 hard links (i.e., 1000 different directory entries naming a single file) to a file, that file only consumes one i-node.
Note that if you use the command:
where sym is the name of an existing file of type symbolic link, the standards do not specify whether the file named link will be created as a hard link to the symbolic link sym or as a hard link to the file to which sym resolves. (The latest revision of the POSIX standard added -L and -P options to the ln utility to let the user choose the behavior they want, but most implementations haven't released updates that conform to this version of the standard yet.)
Hi general_franco,
By definition, you can't hard link files that are on different filesystems.
When asking questions like this, it always helps to know what operating system you're using.
Have you tried:
? Adding the trailing / to the pathname operand you pass to find will fail if that pathname argument doesn't resolve to a directory, but it should cause any symbolic links contained in that pathname to be resolved with or without the -L option.
These 3 Users Gave Thanks to Don Cragun For This Post:
Hello,
I would like to create symbolic links for a series of files in my cwd (after confirming that the links don't already exist). The above files all have a similar prefix, but different extensions.
I created a shell script like shown below and I get an error message "No such file or... (4 Replies)
Hello,
I'm having a trouble with the find cmd.
I would like to find all the java versions on my systems.
I have solaris 9 & 10 RHEL and SUSIE.
java -version
doesn't give all the versions on the server.
So I am trying to use the find command to find them all
find / -name java
I would... (7 Replies)
Hi gurus, greetings.
Objective: find in a path directories that are named Logs. In each found Logs dir search for files with .log extension and remove -atime +6. (Note for test/example, rm and -atime is not used).
Issue: If I execute the script without redirecting output to a file, on... (8 Replies)
Hi All,
My target is to find the biggest files opened by any process and from that i have to find process id and the corresponding file also to avoid file system being hung-up.
Finding the process id: is to kill the process
Finding the biggest file: is to remove the file
To get the process... (0 Replies)
I am trying to copy 2 types of files so I can archive them. I tested with a set of commands:
touch -t $(date -d "-60 day" +%Y%m%d) WORKDIR/REF
find TARGETDIR/ -type f -maxdepth 1 -iname \*.out\* -or -iname \*.log\* ! -newer WORKDIR/REF -exec ls -l {} \;
This correctly lists any files in the... (2 Replies)
i have a list of files below:
rwxrwxrwx 1 pipe pipe 180 Mar 4 22:47 del_0n_Date
-rwxrwxrwx 1 pipe pipe 472 Mar 4 22:58 mail_Check
-rw-r--r-- 1 pipe pipe 92 Mar 4 22:58 minfo.txt
-rwxrwxrwx 1 pipe pipe 609 Mar 5 05:12... (6 Replies)
Hi,
i wan to search the file starting with Admin into the directory Output. I am running below command:
find /appl/Output -name "Admin*" -prune
but this command is going into the sub directories present under output. I do not want to search under sub directories. Any help will be highly... (6 Replies)
Would I be correct in assuming that find doesn't bother recursivley searching down sim links. (It doesn't seem to so I guess it doesn't!!!) Is there anyway to make it do so? (3 Replies)