How to switch existing file field from public to private? I have a Drupal 7 website with an existing file field set to store files in the public folder (i.e. sites/default/files).

I need to switch this one field so that it stores files in the private folder. Because the field has already been set to public and there are a number of existing files in place - the option to change the settings to private is not available in the user interface. I was wondering if anyone has a way to make this change manually in the database.
I know this was asked a while ago, but posting this in case anyone else needs it:

https://gist.github.com/thsutton/6878688

This gist takes the steps from this comment on d.o. and makes it into a simple script: https://drupal.org/node/1806220#comment-6960906

Here's the steps from the linked comment:


backup your site and db
copy the table for your field (and the revisions table for the field) to make a backup (in my case i copied: field_data_field_attachments to field_data_field_attachments_bk)
empty table field_data_field_attachments
go to drupal and the option to change the file system should be available, so change it
copy all data from field_data_field_attachments_bk back to field_data_field_attachments
go to drupal, select your content type, select your file field, in file path settings select retroactive update
click save and it will move all your files to the right place in file system and update your db to the new path


I ran through the script and field updates on several fields myself recently and it just works.