tsql - SQL Server FileTable move directory with content T-SQL -


i looking @ trying move directory in filetable 1 location another. cannot seem find information on how move directory has sub directories , files in different location via t-sql.

i have found examples of how move files 1 location , method work on directory long empty not when has content in throws conflict.

i assume because path locators need regenerating in underlining content on directory being moved not sure how achieve this.

any or guidance appreciated

update one

after research in current version of sql server 2016 cannot see method of doing without form of recursive logic. have solution trying build via using recursive logic in c# code open source database library rather doing in t-sql.

once completed update further process , how works.

although not answer in t-sql thought might of benefit post here theory of how it.

i solved problem using c#.net able make recursive function allowed me move structure of directories. built in function in filetable extension of open source database library dotnetsdb.

if want see source code feel free go website , @ sql server general filetable extension update methods.

general theory

  • a recursive function starts
  • it creates new directory @ new location using same name folder passed
  • it loops on folders in old directory , runs recursive function again next sub folder layer
  • after loop has finished gets files have current directory recursion parent , loops on them transfering parent_path_locators new folder
  • once files have been moved grabs old current folders stream id
  • it deletes old current directory
  • once deleted updates newly created directories stream id original 1 has been deleted.

general summary

because function recursive creates folder structures first , working backwards transfers files new location , removes original directories 1 one. @ end of each recursion reason delete folder can put stream id no change has occurred other physical location being moved.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -