Trying to use a wildcard file path name, and it does not show error even though there is no file

Anonymous
2022-10-21T22:04:32.927+00:00

I am trying to use a wild card file name, and it works when there is a file name that meets the wild card condition.

My expression using a wild card is like this:
@markus.bohland@hotmail.de ('Ma_Check_Detail_Art Hre & Rb Center','*_',formatdatetime(utcnow(),'MMddyyyy'),'.csv')

253181-image.png

It works fine when we have a file that that meets the condition of the wildcard file path.

But, when I try to create a case by deleting that file, it still passes the test as if there is a file with a blank data.
I was expecting to see an error message like "specified file does not exist".
253110-image.png

Bottom is just a screenshot linked service page (with no specified File name path indicated).
253156-image.png

But, when I try to indicate the wildcard path name here as well, it shows an error message as "The specified resource name contains invalid characters.".

253144-image.png

Where do I have to modify (to get an error message if there is a case that fails the test - like no file exists)?

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,639 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Subashri Vasudevan 11,231 Reputation points
    2022-10-22T10:53:02.393+00:00

    Hi @Anonymous

    Thanks for the ask and using Microsoft Q&A platform.

    As i understand the ask here, you want to make the pipeline fail if the specific file doesn't exist. Please correct my understanding if it is wrong.

    In order to make the pipeline fail, you can use a look up activity and just read the first row. If the corresponding file doesn't exist, look up will fail. If the file is available, look up will pass and then you can connect your copy activity.

    Below is the error we get if the file doesnt exist while we try to lookup.

    "ErrorCode=UserErrorFileNotFound,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=ADLS Gen2 operation failed for: Operation returned an invalid status code 'NotFound'. Account: 'Acctname'. FileSystem: 'Input'. Path: 'Sales1.csv'. ErrorCode: 'PathNotFound'. Message: 'The specified path does not exist.'. RequestId: '82b1f76d-c01f-0004-3b03-e6af62000000'. TimeStamp: 'Sat, 22 Oct 2022 10:44:29 GMT'.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=Microsoft.Azure.Storage.Data.Models.ErrorSchemaException,Message=Operation returned an invalid status code 'NotFound',Source=Microsoft.DataTransfer.ClientLibrary,'",

    Hope it helps. Let us know for any further clarification.

    253242-screenshot-2022-10-22-at-42141-pm.png

    1 person found this answer helpful.

  2. Subashri Vasudevan 11,231 Reputation points
    2022-11-04T02:49:54.597+00:00

    Hi,

    What we mean to say is, you need to use a lookup activity and decide whether to copy or not.

    In the lookup settings, you need to mention the appropriate file name in the wildcard file path to make it fail.

    See below picture. Im using this expression in the wildcard to match files having todays date. If there is no such file, lookup will fail. I think this case should work for you. If not, let us know what expression you use in the copy activity file name portion

    @markus.bohland@hotmail.de ('testfile_',formatDateTime(utcnow(),'yyyyMMdd'),'.csv')

    257045-screenshot-2022-11-04-at-74835-am.png

    If you use a wildcard like testfile_*.csv, then look up wont fail, as it just doesnt find any matching file of the mentioned criteria. See below pic -

    257071-screenshot-2022-11-04-at-75349-am.png

    Again, if this doesn't suit your requirement, you can use a get meta data activity and use a if condition like below to decide if you need to copy or not based on filename. If file is there True part of if will run, meaning, you can have your copy activity inside that. If no file, False part of if would work where you can place your web activity inside that.
    257054-screenshot-2022-11-04-at-80111-am.png
    In my case, it ran false part
    256986-screenshot-2022-11-04-at-80053-am.png


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.