Copy file activity not working for directory length more than 248 characters

I am getting error if I use copy File activity where the target directory path is more than 248 charecters. Any workaround for this, I dont want to use any third party tools .


It’s the error associated with Windows, not with UiPath
Either need to limit your directory path or need to use the third party tool


Hi @Yoichi ,

Anything can be done through invoke code , I tried the below code but it is throwing error:
File.Copy(sSource, sTarget, True)

Hi @Ritika_Singh

Just a quick suggestion though I don’t know if it will work, if the error is due to the file name character count why can’t we rename the file before coy file activity and make to its original name after that.



The error is not due to the filename length but it is due to the length of the directory path

That’s because Windows limits the length of paths. This is a Windows thing, not a UiPath thing. If you have such long paths you need to resolve this, as it’s not just UiPath where you’ll have problems. Your IT staff shouldn’t be letting this happen, assuming they’re shared folders on a network drive.

Yes the destination folder is on a shared drive , hence the path is too long , can you please help us with any other workaround

Put the files somewhere else that isn’t such a long path. Again, this is a limitation of Windows, not UiPath.


the destination folder is on a shared drive

The following way might be workaround. (It depends on your environment. )

It assumes that we have the following long path and want to access target.txt


In advance, mount \\server\AAA\BBB\CCC...\YYY as X:\ , for example, using explorer.

Then we can access it using shorter path : X:\ZZZ\target.txt