Does anyone know of a way to detect a symbolic link using newlisp functions? I suspect there is a straightforward way.
Consider the following:
> !ls -l
total 6432
lrwxr-xr-x 1 11 Dec 4 16:36 testpic -> testpic.eps
-rw-r--r-- 1 2602422 Dec 4 16:32 testpic.eps
> (file-info "testpic.eps")
(2602422 33188 0 501 0 1165271560 1165271558 1165271559)
> (file-info "testpic")
(2602422 33188 0 501 0 1165271560 1165271558 1165271559)
>
These look exactly the same to file-info.
One solution is use newlisp's exec command and parse out the "l" indicating a symbolic link. I'd prefer something faster and not dependent on "ls".
Thanks.
John
Symbolic Links
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
yes - I had a problem in this respect when trying to write a find-duplicates script http://newlisper.blogspot.com/2005/12/f ... cos-x.html (one of my first newLISP scripts). I discovered that one of the Python guys had put a link to a file further up the directory tree in one of his applications:newdep wrote:Aaa nice, then recurcive directory walks will finaly work under linux ;-)
Code: Select all
/Users/me/Library/ScriptingAdditions/TextCommands.app/
Contents/Frameworks/Python.framework/Versions/2.3/Frameworks
/Python.framework/Versions/2.3/Frameworks/Python.framework/
Versions/2.3/Frameworks/Python.framework/Versions/2.3/
Frameworks/Python.framework/Versions/2.3/Frameworks/Python.
framework/Versions/2.3/Frameworks/Python.framework/Versions/
2.3/Frameworks/Python.framework/Versions/2.3/Frameworks/
Python.framework/Versions/2.3/Frameworks/Python.framework/
Versions/2.3/Frameworks/Python.framework/Versions/2.3/
Frameworks/Python.framework/Versions/2.3/Frameworks/Python.
framework/Versions/2.3/Frameworks/Python.framework/Versions/
2.3/Frameworks/Python.framework/Versions/2.3/Frameworks/
Python.framework/Versions/2.3/Frameworks/Python.framework/
Versions/2.3/Frameworks/Python.framework/Versions/2.3/
Frameworks/Python.framework/Versions/2.3/Frameworks/Python.
framework/Versions/2.3/Frameworks/Python.framework/Versions/
2.3/Frameworks/Python.framework/Versions/2.3/Frameworks/
Python.framework/Versions/2.3/Python