Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Ektron Find Replace Library Folder Names

Posted on October 23, 2013October 26, 2015 By David Kittell

This script will rename folder paths of renamed CMS folders.

SET XACT_ABORT ON

BEGIN TRAN

DECLARE @currtext NVARCHAR(255)
DECLARE @newtext NVARCHAR(255)
DECLARE @search NVARCHAR(500)
DECLARE @replace VARCHAR(500)
DECLARE @pos INT
DECLARE @id BIGINT
DECLARE @libtype_id INT

-- folder names
SET @search = '' --string to find
SET @replace = '' --replacement string

DECLARE curs CURSOR LOCAL FAST_FORWARD
FOR
SELECT folder_id
	,folder_name
	,libtype_id
FROM library_folder_tbl
WHERE folder_name LIKE '%' + @search + '%'

OPEN curs

FETCH NEXT
FROM curs
INTO @id
	,@currtext
	,@libtype_id

WHILE @@fetch_status = 0
BEGIN
	SET @newtext = replace(@currtext, @search, @replace)

	PRINT 'Changing ' + @currtext + ' to ' + @newtext

	UPDATE library_folder_tbl
	SET folder_name = @newtext
	WHERE folder_id = @id
		AND libtype_id = @libtype_id

	FETCH NEXT
	FROM curs
	INTO @id
		,@currtext
		,@libtype_id
END

CLOSE curs

DEALLOCATE curs

-- subfolder paths
SET @search = '' --string to find
SET @replace = '' --replacement string

DECLARE curs CURSOR LOCAL FAST_FORWARD
FOR
SELECT folder_id
	,subfolder
	,libtype_id
FROM library_folder_tbl
WHERE subfolder LIKE '%' + @search + '%'

OPEN curs

FETCH NEXT
FROM curs
INTO @id
	,@currtext
	,@libtype_id

WHILE @@fetch_status = 0
BEGIN
	SET @newtext = replace(@currtext, @search, @replace)

	PRINT 'Changing ' + @currtext + ' to ' + @newtext

	UPDATE library_folder_tbl
	SET subfolder = @newtext
	WHERE folder_id = @id
		AND libtype_id = @libtype_id

	FETCH NEXT
	FROM curs
	INTO @id
		,@currtext
		,@libtype_id
END

CLOSE curs

DEALLOCATE curs

--rollback tran
COMMIT TRAN

Source: http://www.skonet.com/Articles_Archive/Helpful_Sql_Scripts_for_Ektron_CMS_400_Net.aspx

Originally Posted on October 23, 2013
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code Ektron MSSQL MSSQL - Ektron MSSQL - Ektron 8.0.2 SQL

Post navigation

Previous post
Next post

Related Posts

Bring Application Back Into Focus

Posted on September 6, 2013October 26, 2015

Sometimes when you are running long processes your application can get away from you and you need to bring the application back into focus. While there are many that may have arguments for or against this method this is one way that has always worked for me. this.WindowState = FormWindowState.Minimized;…

Read More

Check Instance Of Application

Posted on May 9, 2014October 26, 2015

Preferred Method: Project Menu -> Properties -> Application -> Check Box: Make Single Instance Application Non-Preferred Method: This code will look in your task manager for the same name of your application, if it exists it will prevent another copy of it from running. ‘ Make sure they only have…

Read More

PowerShell – Get Network Statistics

Posted on November 9, 2015November 9, 2015

function Get-NetworkStatistics { [OutputType(‘System.Management.Automation.PSObject’)] [CmdletBinding(DefaultParameterSetName=’name’)] param( [Parameter(Position=0,ValueFromPipeline=$true,ParameterSetName=’port’)] [System.String]$Port=’*’, [Parameter(Position=0,ValueFromPipeline=$true,ParameterSetName=’name’)] [System.String]$ProcessName=’*’, [Parameter(Position=0,ValueFromPipeline=$true,ParameterSetName=’address’)] [System.String]$Address=’*’, [Parameter()] [ValidateSet(‘*’,’tcp’,’udp’)] [System.String]$Protocol=’*’, [Parameter()] [ValidateSet(‘*’,’Closed’,’CloseWait’,’Closing’,’DeleteTcb’,’Established’,’FinWait1′,’FinWait2′,’LastAck’,’Listen’,’SynReceived’,’SynSent’,’TimeWait’,’Unknown’)] [System.String]$State=’*’ ) begin { $properties = ‘Protocol’,’LocalAddress’,’LocalPort’ $properties += ‘RemoteAddress’,’RemotePort’,’State’,’ProcessName’,’PID’ } process { netstat -ano | Select-String -Pattern ‘\s+(TCP|UDP)’ | ForEach-Object { $item = $_.line.split(‘ ‘,[System.StringSplitOptions]::RemoveEmptyEntries) if($item[1] -notmatch ‘^\[::’) { if (($la =…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes