Eugene Smiley on 5 Nov 2005 00:09:52 -0000


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

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stephen Gran wrote:

> On Fri, Nov 04, 2005 at 04:39:28PM -0500, Eugene Smiley said:
>>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 to get exactly the right thing, of course, but that's
> roughly what you want to do, I think.

And after some minor fiddling the result is:

#!/bin/sh

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


Caveat for anyone else who uses it, it doesn't handle shortcuts with
spaces in the name -- not an issue for me, but I noticed I do have a
few in that category.

Stephen, many thanks!



-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0.3

iQA/AwUBQ2v3/ukD7QKn7f0vEQLTBwCfYLQ6KKJHmDvZzkbAHRODN66clLYAoNOJ
lH9uVZKMrcriFEtEpED/1mXU
=WtYu
-----END PGP 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