Rename invoice could not find a part of the path

I use a Move File activity to change the name of a pdf file (a model after the exercise from Academy).
image
… but I get this error:
image

I can imagine that you think I didn’t check the path, but I believe I did it :frowning:

To demonstrate:

  1. In the field From is a variable set in For Each:
    I select the folder where are the invoices
    image
    … and I check the path with a Log Message activity:


    … and I created an array of string, representing only the pdf files from the selected folder.

    The folder has some sub-folder … wandering if this is a problem?

    … and finally, I iterate through each element from the array of strings:

    I also use a Log Message activity, and everything seems fine:
    image

  2. In the field To I set the new file name variable
    … that I built like this:
    image
    … and I also used a Log Message to make sure it’s correct:
    image

So, what do you think I’m doing wrong?
I attached also the whole project, maybe it helps.Process Invoices2.zip (353.8 KB)

Hello,

Replace your “/” in your filename by a valid character for a filename (it might be interpreted as a folder separator).

Note that you can convert your DateTime to string with a format, for example invoiceDate.ToString("yyyy-MM-dd")

Hi @msan
Thank you for checking my question. Can you please give me more details? Unfortunately I don’t understand what to do :frowning:

Replace

invoice.Replace(invoice.Substring(0, invoice.IndexOf(".")), invoiceType+"_"+invoiceDate.ToString.Replace(" 00:00:00", "")+"_"+totalAmount.ToString+invoiceCurrency)

by

invoice.Replace(invoice.Substring(0, invoice.IndexOf(".")), invoiceType + "_" + invoiceDate.ToString("yyyy-MM-dd) + "_" + totalAmount.ToString + invoiceCurrency)

you’ll obtain Sighted_2020-04-05_5000EUR.pdf as name. If you prefer another date format, tweak the format string.

2 Likes

Thank you!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.