help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Function to find symlink target


From: Jean Louis
Subject: Re: Function to find symlink target
Date: Wed, 1 Jun 2022 10:43:39 +0300
User-agent: Mutt/+ () (2022-05-21)

* Emanuel Berg <incal@dataswamp.org> [2022-05-31 15:32]:
> > Symlinks greatly help in that case, and do spare the hard
> > disk space.
> 
> Compared to duplicating all the files physically on the
> local machine?

Yes, symlinks can be in a different file structure than their actual
files on the hard disk.

For example:

~/hyperscope/1/2/3/my-file.pdf may be in a complex structure of other
documents, maybe in the same directory could be other 200 files, and
file could be related to ABC subject.

Same file in the public_html directory:

~/public_html/www.example.com/files/world/my-file.pdf 

then may give quite different context, different meaning in a different
file structure. And even file name in WWW structure should may become
more meaningful then the actual file name, that is matter of marketing
online. 

Then I use often this command to give me the actual WWW link to the
file provided file is in my public_html directory:

(defun loc ()
  "Locates the files, and if it is in public_html, it constructs the URL"
  (interactive)
  (let* ((files (dired-get-marked-files)))
    (kill-new (with-temp-buffer
                (while files
                  (let* ((file (pop files))
                         (uri (if current-prefix-arg file
                                (public-html-rest file))))
                    (insert uri "\n")))
                (buffer-string)))))

If the file is then located in WWW structure, I would do `M-x loc' on
the file and get a result like:

https://www.example.com.com/files/world/2020/04/foundation.pdf

but if file is not located in WWW structure, I would get result like:

~/public_html/www.example.com/files/world/my-file.pdf 

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]