How to Upload the files from FTP folder to sharepoint folder

Hi,
I have to get the files from FTP, then need to create folder in SharePoint & download or upload the files into that SharePoint folder.
Can someone please me guide. Thanks!!

Hi @TJamuna ,

Step 1: Download Files from FTP

  1. Install FTP Activities:
    • In UiPath Studio, install the UiPath.FTP.Activities package from the Manage Packages section.
  2. Connect to FTP:
    • Use the With FTP Session activity. Provide the server address, username, and password.
  3. Download Files:
    • Use the Download activity inside the With FTP Session scope. Specify the remote directory path and the local folder path to save files.

Step 2: Create a Folder in SharePoint

  1. Install Office365 Activities:
    • Install the UiPath.MicrosoftOffice365.Activities package.
  2. Set Up Scope:
    • Add the Office365 Scope activity. Authenticate using OAuth or Application ID and Secret.
  3. Create Folder:
    • Use the Create Folder activity. Specify the SharePoint site URL and the desired folder name.

Step 3: Upload Files to SharePoint

  1. Prepare Local Files:
    • From the files you downloaded in Step 1, ensure they are in the correct local folder.
  2. Upload Files:
    • Use the Upload File activity from the Office365 package. Specify the local file path and the destination folder in SharePoint.
1 Like

Please let me know if this helped.

Happy Automation :innocent:!

Hi @TJamuna

To accomplish this, first, use the FTP Get File activity to download files from the FTP server. Then, use the SharePoint Create Folder activity to create a folder in SharePoint. Finally, upload the downloaded files using the SharePoint Upload File activity into the newly created folder. Make sure you have the necessary packages installed for both FTP and SharePoint operations.

1 Like

Thanks for the Steps @sallavudeen_ashwin
In the upload file activity, how to provide the source path, I have a multiple files in the folder. I have to download the folder with insides files


Please let me know

@TJamuna

Use Directory.GetFiles(“C:\LocalFolderPath”) to get all the files from the folder, then loop through each file with a For Each activity. Inside the loop, use the OneDrive Upload File activity, setting the File Path to the current file in the loop and the OneDrive Folder Path to your desired destination folder on OneDrive. This will upload all the files to OneDrive.

For More:
files = Directory.GetFiles(“C:\LocalFolderPath”)

For Each filePath In files
OneDrive Upload File
- File Path: filePath
- OneDrive Folder Path: “Documents/UploadFolder”
Next

1 Like

Hi @TJamuna ,

  1. Provide the Source Path in Upload
    If you have multiple files in a folder, you can use the “For Each file in folder” activity to iterate through all the files. Here’s a breakdown:
  • Use the “Assign” activity to get the list of files in the folder:

    fileArray = Directory.GetFiles(“C:\YourFolderPath”)

    (Make sure `fileArray` is a variable of type `String[]`.)
    
    
  • Add a “For Each file in folder” activity to loop through the fileArray. Inside the loop:

    • Add an activity like “Upload File”, where you can provide item (the current file in the loop) as the source path.

1 Like

Hi @TJamuna ,

Please make sure to check that box in the screenshot. Let me know, if this resolves your query. Thanks!

1 Like

Thanks@sallavudeen_ashwin
Can you please provide the Xaml.

Hi @TJamuna ,

I have randomly pulled that activity to show you. Please do implement the steps and let me know you if you face any issue please.

We will figure this out. Also ,please mark if this resolved your query. Thanks!

1 Like

Hi @TJamuna

Try below step:

First
Get Files from FTP: - Use the FTP Get Files activity to download files from the FTP server to a local fold

  1. Assign:

    • Use the Assign activity to get all files from the local folder.
      files = Directory.GetFiles("C:\LocalFolderPath")
      
  2. For Each:

    • Add a For Each activity to iterate over the files array.
      • TypeArgument: String
      • Values: files
  3. Inside For Each:

    • Inside the loop, use the OneDrive Upload File activity.
      • File Path: filePath (current file in the loop)
      • OneDrive Folder Path: "Documents/UploadFolder" (path to your OneDrive folder)

Happy Automation

1 Like

@prashant1603765 @sallavudeen_ashwin
Thanks for the reply

How to provide the Files path instead of string in Uploadfile activity. Please guide me.

Hi @TJamuna

Using the variable that represents the current file in the For Each loop (like currentFilePath), you can dynamically provide the file path to the OneDrive Upload File activity. This way, each file in your local folder will be uploaded to OneDrive as intended.

or share the properties screenshot.
Happy Automation

@prashant1603765


Please check the screenshot.

Great @TJamuna

In the for each just change Argument type as - “Enumerable (Of IResource)”

Let me know if you still facing issue

Can you please guide which one need to pick

@TJamuna

Seems like below:

‘IEnumerable <T’>
Choose string under T

@prashant1603765 Please check the screenshot still facing the issue

IEnumerable <T’>
Choose string under T

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