From: Kyle Rawlins Date: 2002-07-28T01:34:33+09:00 Subject: Re: Some basic Ruby questions --wRRV7LY7NUeQGEoC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jul 27, 2002 at 07:00:01AM +0900, Daniel Bretoi wrote: > I just wanted to point this out as a caveat in particular as someone > mentioned that filenames and directories can contain newlines. >=20 > db Didn't think of that at all - I think any of the other solutions posted that called 'ls' have this problem too. The only way to do it correctly by maki= ng calls to ls seems to be to parse the output of the dired mode (which isn't hard, but hard to do in one line). You can also have ls output strings meant for C which are properly escaped = and quoted, but I don't know of any way to unescape them without eval (also possibly causing issues if for some strange reason a #{} sequence is in a filename): `ls -Q1 --color=3Dnever *.jpg`.split("\n").collect do |item| eval("#{item}"= ) end So I guess the pure ruby methods are better. btw, to make one of these crazy files in bash (this took me a bit of work) = type the following line: touch 'test^v^jing' where the ^v is typed as control-v -kyle =20 > On Sat, Jul 27, 2002 at 03:55:11AM +0900, Kyle Rawlins wrote: > > or even something like > >=20 > > def pictureMethod > > `ls -1 --color=3Dnever *jpg*`.split("\n") > > end --=20 http://mas.cs.umass.edu/~rawlins -- I used to know the answer to that one, before I ate so many preservatives... (Zippy) --wRRV7LY7NUeQGEoC Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9QsuWncsSsHSBypARAjolAKCn3M12ruvtklwbnI7m8mO2z9DCaACggmH6 QkkWgHC6ZR4h5EQVaSfN9fE= =yrXb -----END PGP SIGNATURE----- --wRRV7LY7NUeQGEoC--