From: Bertram Scharpf Date: 2009-08-06T23:48:29+09:00 Subject: Re: Trimming some string using ruby Hi, Am Donnerstag, 06. Aug 2009, 22:20:10 +0900 schrieb Rüdiger Bahns: > Bertram Scharpf schrieb: > > As the file size will vary in width and the file names could >> contain spaces this will be a little bit safer: >> l = "-rw-rw-r-- 1 user user 12238 Aug 6 01:02 app3.sql" >> filename = (l.split nil, 6).last[ 13..-1] >> Bertram > > Why not just > > filename = (l.split nil, 9)[-1] > > ? Because it is still allowed that filenames contain spaces (and even other whitespaces what will fail with ls). Especially on Samba mounts you have to expect that users heavily make use of it. Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de