Ronaldo7
Ronaldo7

Reputation: 3

Changing the location of a folder without affecting the path(s) stored in the database

I have a folder that stores images and the paths to the images are stored in the database. There are almost 2500+ employee images stored there.

If I want to change the physical location of the folder that has the images, how do I manage the stored paths in the DB and the virtual path, root and all the related info.

Upvotes: 0

Views: 93

Answers (1)

SouthShoreAK
SouthShoreAK

Reputation: 4296

Well, here is what I would do:

  1. Copy your images to the new directory. (Leave the old directory in place for now)
  2. Run a SQL update script on your DB to change the stored location. (Without knowing your db structure I can't say more.)
  3. Update your app code to point to the new directory.
  4. Test your app to verify that is uses the new directory.
  5. Rename the old directory to something else, so that any link to it would break.
  6. See if anything is broken, and fix it!

Upvotes: 1

Related Questions