|
Home > Archive > Programming with dBASE > July 2005 > populating a table
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
populating a table
|
|
| Simon Catchpole 2005-07-06, 8:23 pm |
| Is it possible to populate a table from a folder of filenames?
I have a number of images in various folders all are jpegs
i.e
c:\image\artist1\one
.jpeg
c:\image\artist1\two
.jpeg
c:\image\artist1\thr
ee.jpeg
c:\image\artist1\fou
r.jpeg
c:\image\artist2\one
.jpeg
c:\image\artist2\two
.jpeg
I want to use the files to populate a table artist.dbf that looks like
artist (char) 40
description (char) 40
image (binary)
the program would need to be pointed to the relevant folder, then store the
filename to the description field, and store the image in the image field.
I already have a program that works if the description field contains the
filename but can't figure out how do do it in reverse.
Any thoughts much appreciated
| |
| Michael Nunn 2005-07-07, 1:23 pm |
| Simon Catchpole asked
> Is it possible to populate a table from a folder of filenames?
Adapting a tip from Bruce Beacham in the thread 'Files Deletion', you could
get the contents of each directory/folder into an array, thus:
a = new array()
a.dir("C:\image\artist1\*.jpg")
The resulting array is five column. The file names are in the first column
of the array.
So you could run down the array and pick up each file name, append a blank
record to your table, and replace the description field with the contents of
a[1,X] (X being the array row number).
Hope this helps - as I understand it, you know how to go on from there (I
don't! - I'd be interested to know how you get an image into a table OLE
field programmatically).
Mike
"Simon Catchpole" < simon@simoncatchpole
.com> wrote in message
news:6CbgB2lgFHA.1760@news-server...
> Is it possible to populate a table from a folder of filenames?
>
> I have a number of images in various folders all are jpegs
>
> i.e
> c:\image\artist1\one
.jpeg
> c:\image\artist1\two
.jpeg
> c:\image\artist1\thr
ee.jpeg
> c:\image\artist1\fou
r.jpeg
>
> c:\image\artist2\one
.jpeg
> c:\image\artist2\two
.jpeg
>
> I want to use the files to populate a table artist.dbf that looks like
> artist (char) 40
> description (char) 40
> image (binary)
>
> the program would need to be pointed to the relevant folder, then store
> the filename to the description field, and store the image in the image
> field.
>
> I already have a program that works if the description field contains the
> filename but can't figure out how do do it in reverse.
>
> Any thoughts much appreciated
>
>
>
>
|
|
|
|
|