FTP Upload activity creating sub folder - Urgent

Hi,

I am using FTP upload to upload files from “C:\Uploads” to “/” root.

Issue: the activity is not uploading to “/”, but creating a folder, and uploading to “/Uploads”.

How can i uploads files without creating a folder?

Include Subfolder checkbox is unchecked.

Thank you for looking.

1 Like

@Palaniyappan

1 Like

@sagacity

Are you trying to upload as “C:\Uploads\” or “C:\Uploads” (no slash) ?

Thanks @pduffy. I tried both, with and without a slash - same result.

@UiPathMaster

Hi, this is a bit critical. @Palaniyappan , @loginerror , @Lahiru.Fernando could you please help.

Much appreciated!

Thank you.

sumitd, if you supply your .xaml and maybe the .php you are using it might help…

@sumitd Which FTP activity are you using? For the Official UIPath FTP activity, I don’t see the option for “Copy Subfolder”.

@sagacity, sorry, i meant, Include Subfolder checkbox. I am using the official UiPath’s FTP activities.

@pduffy - i will add xaml in just a bit. It is basically a Upload Files activitu within a With FTP activity. UiPath’s official FTP.

Not sure which PHP file you would want me to add?

Sorry - I don’t see that checkbox either. I’ll await your xml and see.

Apparently in the newest version of Studio, it doesn’t have/allow the most recent version…not sure what the deal is with that. Anyway, I see what you’re referring to now.

I think I see the issue. You’re passing just the C:\Uploads folder to the Local Path - so, this path gets handed of to the ftp client. The client assumes since you’re giving it a directory name, you want that sent as well.

To send just the files, you’ll need to iterate through the files in the directory, send them one at a time. This will eliminate the folder being sent and created

Thanks @sagacity, i understand what you mean - i will try that and post it. Sounds reliable.

Thank you very much!

@sagacity - iterating through the files is fine, but how will I upload a file at a time? How and what will be the value I need to pass to the upload files activity?

Thank you!

Assuming using “With ftp session”; within that activity, use the “For Each” activity.
for Values, use Directory.GetFiles(“c:\Upload”); the foreach object defauts to name “item”

Then, in For Each Body, place “Upload Files” ftp activity, and set “Local Path” to item.ToString
Set the rest as normal.

When executed, the bot will connect to ftp server, then run the for each loop, which will populate the “item” collection with the list of files from "Directory.GetFiles(“C:\Upload”) - the loop the starts, and indexes to the first item, so, item.tostring will equal the full path value of the the first file in the collection, this is what “Upload Files” uses as its input, and uploads that files. The loop then goes to the next file, passes to upload, etc., until the collection is empty.

1 Like

@sagacity - this worked perfectly! I was able to upload files without creating the “Upload” folder.

Thank you very much for the timely response and this answer! Much appreciated!

Also, sorry for a late reply - client’s RDP connection was down and I couldn’t test earlier.

1 Like

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