The Move File activity is creating files instead of folders

Hello,
The process stops running within the Switch with the following error.

“The MoveFile to 2015 Folder: Cannot create a file when that file already exists”

image

It appears that MoveFile is creating the new files named “invoices 2015”, “invoices 2016”, “invoices 2017” and “invoices 2018”, instead of creating folders with those names and moving the files into them. Any thoughts on what may be causing this? Thanks

Hi @jcam5mil

as the activity name said, it is only for move files already stored in your local machine, not for creating folders, if you want use the create folder activity

another advice, i saw that you are tryin to get the file name without extension, for that you can use the following code

Path.GetFileNameWithoutExtension(FileName)

Regards

@jcam5mil

Move file basically will move the file but not create folders and basically there is some confusion in the documentation…it says destination path…but ideally it is the full destination path including the filename as well…so what you gave is to create a file in folder InvoicesDirectory with a filename of invoices 2015…and I guess you are downloading to same folder

So instead first use a create folder and then use Path.Combine(InvoicesDirectory,Path.GetFineNameWithOutExtension(File.FullName),File.Name)

And in create folder Path.Combine(InvoicesDirectory,Path.GetFineNameWithOutExtension(File.FullName))

cheers

Thank you for the quick response and information! That worked!

Hi

glad to hear that, please remember to mark as solution to help other people reach the solution!

Regards

1 Like