<div dir="ltr">Try to embed this code in a JSP:<div><br></div><div><div>        String folder = "/test";</div><div><br></div><div>        CmsObject cms = CmsJspElFunctions.getCmsObject(pageContext);</div><div>        List<CmsResource> files = cms.getFilesInFolder(folder);</div><div><br></div><div>        for (CmsResource file : files) {</div><div>            List<CmsRelation> relations = cms.getRelationsForResource(file, CmsRelationFilter.SOURCES);</div><div>            out.print(file.getRootPath() + " is orphan: " + (relations.size() == 0));</div><div>        }</div></div><div><br></div><div>Hope this helps you.</div><div><br></div><div>Stephan</div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-02-27 9:58 GMT+01:00 always.work.in.progress always.work.in.progress <span dir="ltr"><<a href="mailto:always.work.in.progress@gmail.com" target="_blank">always.work.in.progress@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span style="font-family:sans-serif;font-size:12.8px">hi Stephan :)</span><br style="font-family:sans-serif;font-size:12.8px"><span style="font-family:sans-serif;font-size:12.8px">i really thank you for your reply!</span><br style="font-family:sans-serif;font-size:12.8px"><span style="font-family:sans-serif;font-size:12.8px">Can you show me a simple code example in order to better undestand that </span><span style="font-family:sans-serif;font-size:12.8px">method you have suggested to me ?</span><br style="font-family:sans-serif;font-size:12.8px"><span style="font-family:sans-serif;font-size:12.8px">say that i have a "test" folder inside opencms VFS:</span><br style="font-family:sans-serif;font-size:12.8px"><br style="font-family:sans-serif;font-size:12.8px"><span style="font-family:sans-serif;font-size:12.8px">/test</span><br style="font-family:sans-serif;font-size:12.8px"><br style="font-family:sans-serif;font-size:12.8px"><span style="font-family:sans-serif;font-size:12.8px">and this folder contains some files (.pdf, .docx, etc)</span><br style="font-family:sans-serif;font-size:12.8px"><span style="font-family:sans-serif;font-size:12.8px">how can i create the script in order to check the "orphaned" relations f</span><span style="font-family:sans-serif;font-size:12.8px">or files inside "/test" folder ?</span><br style="font-family:sans-serif;font-size:12.8px"><br style="font-family:sans-serif;font-size:12.8px"><span style="font-family:sans-serif;font-size:12.8px">thanks in advance.</span><div class="HOEnZb"><div class="h5"><br><br>Il martedì 27 febbraio 2018, Stephan Schrader <<a href="mailto:zstephanz@gmail.com" target="_blank">zstephanz@gmail.com</a>> ha scritto:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>you can use: <i>CmsObject.getRelationsForResou<wbr>rce(CmsResource resource, CmsRelationFilter filter)</i> with <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);float:none;display:inline"><i>CmsRelationFilter.SOURCE</i></span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);float:none;display:inline"> as parameter. If the result is empty, no other resource references the given resource.</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);float:none;display:inline">Stephan</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);float:none;display:inline"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-02-23 17:59 GMT+01:00 always.work.in.progress always.work.in.progress <span dir="ltr"><<a href="mailto:always.work.in.progress@gmail.com" target="_blank">always.work.in.progress@gmail<wbr>.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>hi all...</div><div>i am using Opencms 10.0.0/mysql set up in multisite environment (<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-style:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:12.8px;background-color:rgb(255,255,255);float:none;display:inline">apache + mod proxy)</span></div><div>i manage some large web sites plenty of xml contents/pages that link to many internal uploaded pdf/images files/other filetypes etc..</div><div>often these files that are not needed anymore, are unlinked from related xml contents, but unfortunately they are not deleted from the vfs workplace and so become "forgotten".. :(</div><div><br></div><div>Is there an internal workplace jsp script or function in order to find these "orphan files" ?</div><div>i mean files that are present in vfs but not anymore linked from any xml contents page;</div><div><br></div><div>these files waste db blob space and the mysql database under opencms is growing in size and getting more and more big..</div><div><br></div><div>i tried to look for a way to do that but i've never found a similar function/method..</div><div>it would be really useful in order to locate these unused  files and delete them.</div><div><br></div><div>thanks in advance for your reply.</div><div><br></div><div>bye.</div><div><br></div><div><br></div></div>
<br>______________________________<wbr>_________________<br>
This mail is sent to you from the opencms-dev mailing list<br>
To change your list options, or to unsubscribe from the list, please visit<br>
<a href="http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev" rel="noreferrer" target="_blank">http://lists.opencms.org/cgi-b<wbr>in/mailman/listinfo/opencms-de<wbr>v</a><br>
<br>
<br>
<br>
<br></blockquote></div><br></div>
</blockquote>
</div></div><br>______________________________<wbr>_________________<br>
This mail is sent to you from the opencms-dev mailing list<br>
To change your list options, or to unsubscribe from the list, please visit<br>
<a href="http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev" rel="noreferrer" target="_blank">http://lists.opencms.org/cgi-<wbr>bin/mailman/listinfo/opencms-<wbr>dev</a><br>
<br>
<br>
<br>
<br></blockquote></div><br></div>