From owner-freebsd-questions  Thu Jan 10 17:12:27 2002
Delivered-To: freebsd-questions@freebsd.org
Received: from fremont.bolingbroke.com (adsl-216-102-90-210.dsl.snfc21.pacbell.net [216.102.90.210])
	by hub.freebsd.org (Postfix) with ESMTP id 70AB337B405
	for <questions@FreeBSD.ORG>; Thu, 10 Jan 2002 17:12:21 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
	by fremont.bolingbroke.com (8.12.1/8.12.1) with ESMTP id g0B1CLs6031232;
	Thu, 10 Jan 2002 17:12:21 -0800 (PST)
Date: Thu, 10 Jan 2002 17:12:21 -0800 (PST)
From: Ken Bolingbroke <hacker@bolingbroke.com>
X-X-Sender: ken@fremont.bolingbroke.com
To: chip <chip@wiegand.org>
Cc: questions@FreeBSD.ORG
Subject: Re: txt file from ls -la?
In-Reply-To: <200201101636863.SM01552@there>
Message-ID: <20020110165555.A5440-100000@fremont.bolingbroke.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: owner-freebsd-questions@FreeBSD.ORG
Precedence: bulk
List-ID: <freebsd-questions.FreeBSD.ORG>
List-Archive: <http://docs.freebsd.org/mail/> (Web Archive)
List-Help: <mailto:majordomo@FreeBSD.ORG?subject=help> (List Instructions)
List-Subscribe: <mailto:majordomo@FreeBSD.ORG?subject=subscribe%20freebsd-questions>
List-Unsubscribe: <mailto:majordomo@FreeBSD.ORG?subject=unsubscribe%20freebsd-questions>
X-Loop: FreeBSD.ORG



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