Remove specific character from string
You could use the LEFT() and RIGHT() functions to do this. 

DECLARE @Folder varchar(20) = '/folder1/folder2/';

IF LEFT(@folder,1) = '/' 
SET @Folder = RIGHT(@Folder ,LEN(@Folder)-1);

IF RIGHT(@folder,1) = '/' 
SET @Folder = LEFT(@Folder ,LEN(@Folder)-1);

SELECT @Folder;


Result

(No column name)
folder1/folder2