Stephen Gran on 4 Nov 2005 22:01:47 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Converting MS Win shortcuts to hard links


On Fri, Nov 04, 2005 at 04:39:28PM -0500, Eugene Smiley said:
> Eugene Smiley wrote:
> 
> Damn. The things you think of after hitting send... I'm also trying
> to 'find' the file in dir b (nested sub-dirs).
> 
> > I'm looking for a one-line or short script to convert a Windows
> > *.lnk into a hard link.
> >
> > - dir a contains the shortcuts
> > - dir b/*/ contains the file being pointed to.
>     ^^^^^^^^
> > - the link name is the filename + .lnk.
> > - trying to do something like:
> 
> foreach (*).lnk (dir a) {find /b/ -name ($1) | ln /a/}

for i in `ls a/`; do 
  lname=${i%%.lnk}
  find b -name $lname -exec ln {} c/$lname \;
done

That will create a bunch of hard links under directory c.  Some fiddling
tog et exactly the right thing, of course, but that's roughly what you
want to do, I think.
-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | DISCLAIMER: Use of this advanced        |
|  steve@lobefin.net             | computing technology does not imply an  |
|  http://www.lobefin.net/~steve | endorsement of Western industrial       |
|                                | civilization.                           |
 --------------------------------------------------------------------------

Attachment: signature.asc
Description: Digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug