Check if files exist inside folder, send mail if not.

Post Reply
PdFUser5000
Member
Posts: 94
Joined: Fri Jun 12, 2020 11:23 am

Check if files exist inside folder, send mail if not.

Post by PdFUser5000 » Fri Oct 22, 2021 12:14 pm

I have files in a customer folder.
I have metadata which consists of info on the files that need to be in the folder.

Sometimes some files are missing and need to be created.

Is it possible to check if the files exist, and if some of them don't, send that info via email to a user?

freddyp
Advanced member
Posts: 654
Joined: Thu Feb 09, 2012 3:53 pm

Re: Check if files exist inside folder, send mail if not.

Post by freddyp » Mon Oct 25, 2021 9:00 am

Have a look at this app: https://www.enfocus.com/en/appstore/pro ... t-wildcard

This app has a success connection for files that were found and an error connection for files that were not found. When a file is injected along the success connection you know it exists and you can throw it in the recycle bin if you do not have to process it right away. Make sure to keep the original files in place so you do not loose them! And if it follows the error connection you know it does not exist and you can send a mail.

If you have multiple nodes with a filename you will have to split the XML so the files can be checked one by one.

PdFUser5000
Member
Posts: 94
Joined: Fri Jun 12, 2020 11:23 am

Re: Check if files exist inside folder, send mail if not.

Post by PdFUser5000 » Tue Nov 23, 2021 11:12 am

What would be the best option to split xml. Saxonica ?

User avatar
magnussandstrom
Member
Posts: 73
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden

Re: Check if files exist inside folder, send mail if not.

Post by magnussandstrom » Tue Nov 23, 2021 9:09 pm

PdFUser5000 wrote:
Tue Nov 23, 2021 11:12 am
What would be the best option to split xml. Saxonica ?
I am using Saxonica for splitting xml.

XSLT Example here:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes"/>
    <!--Splits the XML-file generated in to single XML-files, one for each row-->
    <xsl:template match="/">
        <xsl:for-each select="/Job/OrderLine">
        <!-- Selects which column value to use as filename for the resulting single XML-file. --> <!-- In this case JobNo and OrderLineName is used. -->
        <xsl:variable name="filename"><xsl:value-of select="/Job/Header/JobNo"/><xsl:text>_</xsl:text><xsl:value-of select="OrderLineName"/><xsl:text>.xml</xsl:text></xsl:variable>
        <xsl:result-document href="{$filename}" method="xml">
<root>
    <xsl:copy-of select="OrderLineName" />
</root>
</xsl:result-document>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>
prepress_geek

PdFUser5000
Member
Posts: 94
Joined: Fri Jun 12, 2020 11:23 am

Re: Check if files exist inside folder, send mail if not.

Post by PdFUser5000 » Wed Nov 24, 2021 6:29 am

magnussandstrom wrote:
Tue Nov 23, 2021 9:09 pm
PdFUser5000 wrote:
Tue Nov 23, 2021 11:12 am
What would be the best option to split xml. Saxonica ?
I am using Saxonica for splitting xml.

XSLT Example here:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes"/>
    <!--Splits the XML-file generated in to single XML-files, one for each row-->
    <xsl:template match="/">
        <xsl:for-each select="/Job/OrderLine">
        <!-- Selects which column value to use as filename for the resulting single XML-file. --> <!-- In this case JobNo and OrderLineName is used. -->
        <xsl:variable name="filename"><xsl:value-of select="/Job/Header/JobNo"/><xsl:text>_</xsl:text><xsl:value-of select="OrderLineName"/><xsl:text>.xml</xsl:text></xsl:variable>
        <xsl:result-document href="{$filename}" method="xml">
<root>
    <xsl:copy-of select="OrderLineName" />
</root>
</xsl:result-document>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>
Thanks!

freddyp
Advanced member
Posts: 654
Joined: Thu Feb 09, 2012 3:53 pm

Re: Check if files exist inside folder, send mail if not.

Post by freddyp » Thu Nov 25, 2021 9:53 am

Please do not mix topics. If you want to contribute more on splitting XML's, create a new topic.

As to the original topic of checking if files exist inside a folder there is now a new app:
https://www.enfocus.com/en/appstore/pro ... -hierarchy

Post Reply