Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


get the structure of the whole breadcrumb within a select in database

Michael Regelin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Sep 27, 2023


We use actually a command file (sh) to create a zip with all attachment from a space.

We create a folder structure for every page in only one hierarchy.


Here is the select to construct the creation of folder and file within a SED command.


select 'sourceFile="/data/confluence/attachments/ver003/'
|| MOD(TO_NUMBER(SUBSTR(sp.spaceid , LENGTH(sp.spaceid) - 2, 3)), 250)
|| '/'
|| MOD(TO_NUMBER(SUBSTR(sp.spaceid , LENGTH(sp.spaceid) - 5, 3)), 250)
|| '/'
|| sp.spaceid
|| '/'
|| MOD(TO_NUMBER(SUBSTR(c.pageid , LENGTH(c.pageid) - 2, 3)), 250)
|| '/'
|| MOD(TO_NUMBER(SUBSTR(c.pageid , LENGTH(c.pageid) - 5, 3)), 250)
|| '/'
|| c.pageid
|| '/'
|| c.contentid
|| '/'
|| c.version
|| '" '
|| CHR(38)
|| CHR(38)
|| ' targetPath="/tmp/wikiadm/'
|| sp.spacekey
|| '/'
|| REGEXP_REPLACE(REGEXP_REPLACE(c2.lowertitle,'[<>:"/\\\*|¦\?]',''), '[ ]+','_')
|| '/'
|| REGEXP_REPLACE(REGEXP_REPLACE(c.lowertitle,'[<>:"/\\\*|¦\?]',''), '[ ]+','_')
|| '" '
|| CHR(38)
|| CHR(38)
|| ' mkdir -p $(dirname "$targetPath") '
|| CHR(38)
|| CHR(38)
|| ' ln -s "$sourceFile" "$targetPath"'
as path
from content c
inner join content c2 on c2.contentid = c.pageid
inner join spaces sp on sp.spaceid = c.spaceid
where c.contenttype = 'ATTACHMENT'
and c.content_status ='current'
and c.prevver is null
and sp.spacekey ='XXXXXX';

 I get this result for every attachment:

sourceFile="/data/confluence/attachments/ver003/119/52/399802369/222/42/1155792972/1155792960/1" && targetPath="/tmp/wikiadm/XXXXX/insérer_un_film_depuis_youtube/image2020-4-16_10-52-16.png" && mkdir -p $(dirname "$targetPath") && ln -s "$sourceFile" "$targetPath"

Now I need to get the whole structure after the spacekey to get the whole bunch of the breadcrumb (ancestor, grand-parent, parent, etc.) to be able to navigate in folder inside the zip file.


Is it doable ?


Thanks for your help.



0 answers

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events