I'm going to start posting a lot of my old Duncan Nuggets (as Dave Burke likes to call them) here for others to start reading. This is the first of a lot to come.
How to move a file from one FileGallery to another
NOTE: This script was written for Community Server 2.1 RTM.
This method uses a stored procedure to move a single file (aka Post) to another File Gallery (aka Section). Attached is an SQL script file named move_file_to_filegallery.zip that when executed, will create a stored procedure named _move_file_to_filegallery in your database.
After the sproc is created, you can execute it by running the following command:
EXEC _move_file_to_filegallery @PostID, @toSectionID, @ClearTags
You need two bits of information beforing executing:
Following the examples above now that we have the two required integers, we can now execute the sproc to move the file. The line would read:
EXEC _move_file_to_filegallery @PostID = 234, @toSectionID = 543125, @ClearTags = 1
NOTE: It is recommended to always clear the Tags, since they only exist in the previous FileGallery and not the new one. So leave it @ClearTags = 1.
There is also error checking built in, so view the Messages for any errors that may have occurred.