Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jan 2002 17:12:21 -0800 (PST)
From:      Ken Bolingbroke <hacker@bolingbroke.com>
To:        chip <chip@wiegand.org>
Cc:        questions@FreeBSD.ORG
Subject:   Re: txt file from ls -la?
Message-ID:  <20020110165555.A5440-100000@fremont.bolingbroke.com>
In-Reply-To: <200201101636863.SM01552@there>

next in thread | previous in thread | raw e-mail | index | archive | help


On Thu, 10 Jan 2002, chip wrote:

> I would like to create a file I can import into mysql that consists of the
> names and sizes of all the files in a directory. The files are images. I
> tried ls -la > images.txt, expecting to get all the info from ls -la, but
> that gave me the file names only. I could just type them all into the
> database but there are apr. 2500 files, so the file import would be much
> easier. How can I get the names and sizes only into a text file?

Something like this would do the job:

  cd /image/directory/
  ls -l | awk '{print $9 "\t" $5}' > /tmp/images.txt

That would give you a tab delimited file with the filenames in the first
column and the file sizes in the second column.

Ken Bolingbroke
hacker@bolingbroke.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020110165555.A5440-100000>