SID-01632: Check file existence inside a directory
| Status: |
Answered |
TWiki version: |
|
Perl version: |
|
| Category: |
CategoryAttachments |
Server OS: |
|
Last update: |
12 years ago |
Is there any way, to check if atleast one file exists inside a topic? I have an image of a green light and an image of a red light. If atleast one file exists in the directory I would like the green light to be shown, if not, then I would like the red light to be shown. Is this possible and can anyone help me out with this?
--
Karthikeyan Elango - 2013-02-04
Discussion and Answer
Do you mean to test if an image is embedded in a TWiki page, or to test if an image is attached to a topic?
In the former use a
%SEARCH{}% with a
RegularExpression $pattern() in the
format parameter. Details in
VarSEARCH,
FormattedSearch.
In the latter case use
IfStatements to test for attached files. Details in
QuerySearch.
It might be more flexible and easier if you create a
TWikiForms based application with a Status field that can be toggled. Based on the value of the Status field you could show a red or green LED. More at
Blog: How to Create a TWiki Application.
--
Peter Thoeny - 2013-02-05
Thanks for your reply. Sorry if I was not clear in my question. In our college's intranet I need to check whether the staff has attached any documents (atleast 1 document) to a topic.
Case 1: I need an image of green light or a tick mark (or any image of my choice) next to the topic name - if the staff has attached a file
Case 2: a red light or cross mark next to the topic name - if the staff has not attached any file.
We need to know the attached file existence by looking at the name of the topic (without opening the topic).
--
Karthikeyan Elango - 2013-02-06
Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the
TWiki consultants if you need timely help. We invite you to
get involved with the community, it is more likely you get community support if you support the open source project!
--
Peter Thoeny - 2013-05-01
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.