Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2002
    Location
    BC Canada
    Posts
    61

    Unanswered: Import directory structure to table

    I need to be able to import a directory file list into a sql table.

    i.e. table contains fields for filename, date etc...

    is this possible?

    thanks?

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    absolutely. you are going to have to use file system objects with sp_OACreate. A solution was posted here a long time ago but the thread may have been lost when the server crashed.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by Thrasymachus
    absolutely. you are going to have to use file system objects with sp_OACreate. A solution was posted here a long time ago but the thread may have been lost when the server crashed.
    Nah....


    http://weblogs.sqlteam.com/brettk/ar...6/28/6895.aspx
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Oct 2002
    Location
    BC Canada
    Posts
    61

    getting there...

    That lastone works Brett, but I can't get it to traverse sub-directories

    what I am trying to do is index a hard drive of images for a real estate database.

  5. #5
    Join Date
    Mar 2005
    Location
    Netherlands
    Posts
    280
    Drawback of letting SQL Server do this is that the directory must be on de server of SQL has to have access to remote locations.

    My first instinct would have been to write a vbs-script (with a filesystemobject and ado connection) that scans the directories and inserts them in the table. This script could be run from any computer that has network access to the SQL Server.

  6. #6
    Join Date
    Oct 2002
    Location
    BC Canada
    Posts
    61

    Needs to be SQL

    Lexiflex, the SQL server has access to the iages via a maped drive.

    We will use this to link the image to the realtor, the listing and image history. The idea is that we want to be able to take image submissions, identify if there already are images for the property, if not add it to the listing, if there is add a flag to the listing indicating a change etc...

    there is another app run from a web page that automatically places the images in the folder, and names, numbers them appropriatly

  7. #7
    Join Date
    Mar 2005
    Location
    Netherlands
    Posts
    280
    So it should be possible to do this in SQL server.

    Just curious: How do you identify which newly found image belongs to what property? And do you keep the images on the filesystem or do you import them in the database?

  8. #8
    Join Date
    Oct 2002
    Location
    BC Canada
    Posts
    61

    Location etc

    The images are named with the ListingID#, and are stored in the file system.

  9. #9
    Join Date
    Mar 2005
    Location
    Netherlands
    Posts
    280
    Good luck with this project! It's always fun to build something and see it at work afterwards.

  10. #10
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    well, just iterate through the Directory table until @@ROWCOUNT = 0
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •