Re: Hard linked files cannot be modified
Re: Hard linked files cannot be modified
- Subject: Re: Hard linked files cannot be modified
- From: Prady K <email@hidden>
- Date: Wed, 16 Nov 2005 21:26:24 -0800
My goal originally was to use it for a feature of my application for
searching within a set of files using Spotlight. Since Spotlight does
not support searching within a scope of file paths I was thinking of
creating a temporary folder, create hard links to the files that I
want to search in that folder and then use that folder as the scope
of search for the Spotlight APIs. Even if you give a file path as the
scope, the query will use the parent folder path of that file path as
the scope and will return results from that folder even if those
files are not in preferred search scope. Although I can filter them
out by comparing against my original scope of search it will cause a
significant overhead if that folder contains hundreds of images, but
only of them is in my search scope. Soft link or aliases does not
work for this purpose. I have tried it. Hard links work since they
give the path to the hard link entry in the search results. It seems
Spotlight gives the path to the last directory entry created to a file.
-
Prady
On Nov 16, 2005, at 4:31 PM, John Stiles wrote:
I don't know your ultimate goal, but if this is for an end-user
application, you should probably use aliases. They are more robust
than either soft links or hard links, and the end user can actually
create and resolve aliases easily in the Finder.
They are not a zero-effort solution; you may have to write code to
interface with aliases. However, they produce the best results.
On Nov 16, 2005, at 4:12 PM, Prady K wrote:
Hi
Thanks everyone for the information. Actually I cannot use soft links
for what I am trying to do. Somehow the hard links seemed to work but
I guess it is out of question now because of these issues.
--
Thanks
Prady
On 11/16/05, Bill Wagner <email@hidden> wrote:
There are several things going on:
1. Your ownership is UID=admin, GROUP=admin. Unless you're
logging in as
a user called "admin" any application that checks ownership may
decide
to disallow over writing, whereas others may ask you for a
password. I
believe this is application specific, but it may also be part of the
lower level policies used by OS X compliant applications. Become
root or
admin and change the ownership and group so they match yours and I
suspect it will work.
2. The same holds true for your editors. How the editor handles a
link
is likely embedded in the code for the editor itself. Even the "ln"
commnand has some options that allow it to overwrite or back up
links.
Why don't you use soft links instead of hard links???
Bill Wagner
Prady K wrote:
Hi
Apologies if this posting is out of the scope of this mailing
list. But
I could not find any better mailing list to post this.
I have a sort of newbie question about hard links to a file. I
create a
hard link to image file using ln. After this I cannot modify the
original file in Preview or any other application for that
matter. The
Preview app in OS X just says document cannot be saved. After
that even
after I unlink the file the original file also cannot be
modified at
all. I understand the concept of the link but I am wondering
why it is
not allowing to modify the files that have being hard linked.
However if I type a text file using vi editor and then create a
hard
link to that file and then open the file using the link and edit it
using TextEdit or vi it saves the file but it breaks the hard link.
i.e. the link count becomes 1.
Before ln
=======
-rw-r--r-- 1 admin admin 20 Nov 16 00:25 test.txt
After ln
=======
-rw-r--r-- 2 admin admin 20 Nov 16 00:25 test.txt
-rw-r--r-- 2 admin admin 20 Nov 16 00:25 testlink.txt
After editing testlink.txt in TextEdit
=======
-rw-r--r-- 1 admin admin 20 Nov 16 00:25 test.txt
-rw-r--r-- 1 admin admin 27 Nov 16 00:26 testlink.txt
TIA
Prady K
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40sprynet.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40blizzard.com
This email sent to email@hidden
TIA
Prady K
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden