Invalid File Name for text file

Hi all,

I was just wondering why the naming convention of this file is not working.
Any help would be appreciated :slight_smile:
RemoteException wrapping System.AggregateException: One or more errors occurred. —> RemoteException wrapping System.IO.DirectoryNotFoundException: Could not find a part of the path ‘\arras-dc\users$\DataMan\Challenge 2\Project Manager – MOD ISS (DV STRAP)29012020\ Salary and Job Specification.txt’.
at System.IO.__Error.WinIOError(Int32 errorCode,
String maybeFullPath)
at System.IO.FileStream.Init(String path,
FileMode mode,
FileAccess access,
Int32 rights,
Boolean useRights,
FileShare share,
Int32 bufferSize,
FileOptions options,
SECURITY_ATTRIBUTES secAttrs,
String msgPath,
Boolean bFromProxy,
Boolean useLongPath,
Boolean checkHost)
at System.IO.FileStream…ctor(String path,
FileMode mode,
FileAccess access,
FileShare share,
Int32 bufferSize,
FileOptions options,
String msgPath,
Boolean bFromProxy,
Boolean useLongPath,
Boolean checkHost)
at System.IO.StreamWriter.CreateFile(String path,
Boolean append,
Boolean checkHost)
at System.IO.StreamWriter…ctor(String path,
Boolean append,
Encoding encoding,
Int32 bufferSize,
Boolean checkHost)
at System.IO.File.InternalWriteAllText(String path,
String contents,
Encoding encoding,
Boolean checkHost)
at System.IO.File.WriteAllText(String path,
String contents)
at UiPath.Core.Activities.WriteTextFile.<>c__DisplayClass13_0.b__0()
at UiPath.Core.Activities.Retry.<>c__DisplayClass1_0.b__0()
at UiPath.Core.Activities.Retry.Do[ResultType](Func`1 action,
Int32 timeoutMS,
Int32 retryCount)
— End of inner exception stack trace —

Server stack trace:
at UiPath.Core.Activities.Retry.Do[ResultType](Func`1 action,
Int32 timeoutMS,
Int32 retryCount)
at UiPath.Core.Activities.Retry.Do(Action action,
Int32 timeoutMS,
Int32 retryCount)
at UiPath.Core.Activities.WriteTextFile.ExecuteAsync(String fileName,
String text,
String encodingStr)
at UiPath.Core.Activities.WriteTextFile.<>c__DisplayClass12_0.b__0()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md,
Object args,
Object server,
Object& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg,
IMessageSink replySink)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg,
Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed,
MessageData& msgData)
at System.Action.EndInvoke(IAsyncResult result)
at UiPath.Core.Activities.WriteTextFile.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context,
IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor,
BookmarkManager bookmarkManager)

@Stabbathehut

Could you please check whether file name contains any special characters or not.

Because your UNC should start with double backslash?

Cheers

Hi, thanks for your response, I have changed this and it is the same error

There are no special characters

\ S see that blank space there?

I would recommend you to test the path e.g. by creating the txt file in Notepad.

Cheers

"\arras-dc\users$\DataMan\Challenge 2"+JobTitle+ Now.ToString(“ddMMyyyy”) + “\Salary and Job Specification.txt” I have changed to this and still error thanks for that though

that is your path, only you can know what is wrong with it… but to be be hones it is obvious that is is not a valid path for anything… it could not start with a \, it should be like c:\ or \\