seeking advice on changing file system path after files have been upload
"Changing the file system path after files have been uploaded may cause unexpected problems on an existing site."
Boy howdy! Is there a quick way to deal with this? I did follow the directions but have a problem.
I have a multisite server. To avoid upgrade snafus, I symlink from, e.g., /drupal/drupal-5.7/files to /drupal/drupal.files.
Then each host gets its own file folder, e.g., /drupal.files/site1.files
Sites work fine but on one of them (call it siteX), I forgot to set the filesystem at the start, just used the default. I would like to clean that up.
I created /drupal.files/siteX.files and COPIED its files in there. They are mostly PDFs - file attachments in Biblio records (as in Biblio module).
Then I set the site X filesystem to drupal.files/siteX.files.
Drupal then changed all the URLs of the attached files in my Biblio records to: mysite.com/files/siteX.files/files/siteX.files/whatever.pdf
Note the extra "files/siteX.files" So file not found.
I tried changing one URL in the Biblio 'file attachment' field but Drupal didn't recognize the change. [I forget details]
I was able to delete the old file, using Biblio , and upload another copy, but (a) this is laborious and (b) Drupal (or Biblio module) adds "_0" to the name of the file, even when the old file has been previously deleted and I'm supposedly starting from scratch.
I was tempted to use sql ( e.g., "update files set filepath to newplace where filepath like oldplace") but caution won out.
I'm not sure if this is Drupal issue, or a Biblio issue (as the files are Biblio attachments).
If anyone's been able to cleanly change a filesystem setting, would you kindly share your experience?
Thank you.

=-=
The only way I know to do it is to go through each record in the DB changing them manually. I suppose if you see a pattern while there you can write a SQL snippet to change them as well.
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
duplicate files (changing file system path)
Thank you, oh well... it's supposed to be do-able.
Do you have any idea why Drupal (or maybe it's Biblio) insists on creating a duplicate file, e.g.,
mypaper.pdf
mypaper_0.pdf
even if I first delete the attached file (nicely, via the Biblio module) & then upload the file again ?
Doesn't all this have implications for moving a test site to a public site?
Or would you just point the file system of the final, public site to the same directory the test site used?
interim solution found to changing file system path
After moral support from Caroline Schnapp at 11heavens.com (good advice dispensed by a good writer) -- was encouraged to muck directly with mysql.
- first changed filesystem path
- then moved files to where I wanted them
- then this:
UPDATE files SET filepath = REPLACE(filepath,'files/','newlocation');
This worked, at least, a basic listing of Biblio records has correct URLs to download PDFs.
I may find that Biblio is confused by the change, but so far so good.
Lesson so far: it is apparently not enough to update the filesystem through Drupal's interface and put files in new place; you have to update the database directly.
=-=
That is correct. Unfortunately when a change is made to settings, it only takes affect on "new" file uploads not uploads made previous to the change.
The same holds true with things like input formats and teaser lengths. If these settings are changed the nodes have to be reopened and resaved so that the changes take effect on node created before the changes were made.
Hats off to Caroline for helping you get through updating the DB directly.
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
thanks!
I was having this problem as well after moving everything to a test site before upgrades. None of my images or files would work anymore. Inspection of the file system confimed that all the files had been copied over fine and also had correct permissions.
I checked all of Drupal's system/file path settings and made sure I had updated them. I even tried disabling and re-enabling the image/image assist modules (before I realized this was affecting PDFs as well). Couldn't find any warnings about this in the docs that go through creating a test site.
Then I sat down and started going through the database looking for our old URL (since it was the only option left). I could see the incorrect paths just below the file attachment info in each image node using Drupal's front end, and knew that the URL had to be referenced wrongly somewhere as it was still looking for our old one.
Then I found this post and realized which table I needed to be looking in, and used the Query example above.
Thanks a million, this was very helpful!
Great!
Great!
Just for the record, the
Just for the record, the biblio module uses the Drupal Upload module to handle file attachments, so what ever happened it's not my fault :-)
Ron.