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

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

Re: find a file and put it in a window


From: Eli Zaretskii
Subject: Re: find a file and put it in a window
Date: Mon, 26 Jul 2004 06:57:28 +0200

> From: Jasen <address@hidden>
> Newsgroups: gnu.emacs.help
> Date: Sun, 25 Jul 2004 19:28:38 -0700
> 
> I would like to find a file in a directory through a shell command:
> 
> ;; Get the newest version of file
>    (setq file (string (shell command "ls -tc 
> C:\\dir1\\dir2\\dir3/file*.txt | head -1")))
> 
> ;; Put the file is a windows
>    (find-file-other-window file)
> 
> The problem is that either Emacs or Windows can't interpret the full
> file name along with directory path correctly and I don't know how to
> fix it?

I think the problem is that the string you get includes a newline
after the name of the file.  You need to remove that before you use
the string as a file name.

(You can see what string Emacs gets by using shell-command-to-string.)




reply via email to

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