Getting file error-The source file does not exist

Hi All,

I am getting error. The source file does not exist even though the file is present.
When I debugged the file name is there.




Hi @marina.dutta

You have given the Wrong path in the Rename file activity I guess. Compare the Path you have given in Studio in Immediate panel and compare it with the original File Path.

In studio you have given the path with out mentioning the Folder name called 8/2/2024 see below,
image

But see the path in your local folder,

Hope it helps!!

@marina.dutta

The below thread helps your issue:

@mkankatala

Path is correct. Even when I hard coded the path

and my path str_pdf is also

str_pdf:C:\Users\service.UiPath-rt2\Downloads\NF-e_-Nota_Fiscal_Eletrônica_de_Serviços-_São_Paulo.pdf

str_pdf:C:\Users\service.UiPath-rt2\Downloads\NF-e_-Nota_Fiscal_Eletrônica_de_Serviços-_São_Paulo.pdf

No your path is wrong try giving the below path,

"C:\Users\service.UiPath-rt2\Downloads\8/2/2024\NF-e_-Nota_Fiscal_Eletrônica_de_Serviços-_São_Paulo.pdf"

Hope you understand!!

@marina.dutta
image
image

Please check the above paths are different

@rlgandu

I checked in properties ,path is same

Hi @marina.dutta

Can you try to update UiPath.System.Activities Package

Regards,

1 Like

@marina.dutta
Update UiPath.system.activities package once
And Please check the scope of that variable.

1 Like

Hi @marina.dutta

Update all the dependencies by making runtime rule as lowest applicable.

Hope it helps!!

1 Like

@marina.duttam,

Try doing other operations with that file path like open, delete etc. I suspect due to special characters system is showing some other name than the actual name or path.

Other approach would be for testing purpose use For Each File In Folder activity to log each file full path to see what’s exact path of the file.

Once you have that path use that for renaming.

Thanks,
Ashok :slight_smile:

Hie @marina.dutta look your local folder drive or storage drive path its in date format and after that that file name -example - c:\folder name\8\2\2024\then file name - this is your path in your machine but when you work on studion the given path you pass is like this
example- c:\foldername\filename so thats why bot is unable to find the path and throw error…
and if have to solve this - after folder name use (now.tostring(“dd:MM:yyyy”) this way you can achieve current date if you are creating everyday or saving your file before rename it
(Your Path Looked Like This)

("your drive location\Downloads\ “+now.ToString(“dd/MM/yyyy”)+”"+“YourFile Name”)
image

mark this solution if you find your query resolve
cheers happy automation

@singh_sumit

It didnot work

@mkankatala

It id not work

Hie @marina.dutta looked into your date folder strucuture its first month then day then year
and you are passing day month year so its not working
image
pass this structure

make a some test case and pass this path and check if its working or not
“C:\Users\service.UiPath-rt2\Downloads"+now.ToString(“M/d/yyy”)+”\2934_1DATAB_239003.pdf"`

“C:\Users\service.UiPath-rt2\Downloads"+now.ToString(“M/d/yyy”)+”\2934_1DATAB_239003.pdf"

`

Okay @marina.dutta

→ Try this approach. Use for each file in folder activity and give the path of the downloads folder like “C:\Users\service.UiPath-rt2\Downloads”
→ Inside for each insert an If condition and give the below condition,

- Condition -> CurrentFile.Name.toString.contains("NF-e_-Nota_Fiscal_Eletrônica_de_Serviços-_São_Paulo")

→ Insde then block insert the Rename file activity.

Try this approach once. And try to debug the process and print the CurrentFile.Name.toString in Immediate panel to check the file name.

Hope you understand!!

If using relative paths, ensure that the working directory is correctly set. For workflows, the working directory might not always be what you expect.

Use Directory.GetCurrentDirectory() for debugging to ensure your relative path is correct.

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