如何通过UIpath在系统中本地创建文件夹

时间:2017-05-29 07:28:57

标签: uipath ui-patterns

我想通过UI路径工作室在C或D驱动器中创建一个主文件夹。创建主文件夹后,我想在主文件夹中创建三个文件夹。

如何在UIpath中解决此问题?

3 个答案:

答案 0 :(得分:0)

使用UiPath中的Create Directory活动。

只需在Activites窗口中搜索。

答案 1 :(得分:0)

你必须正确地提到路径如下: -

"C:\Users\Documents\UiPath\Your_Folder_Name"

答案 2 :(得分:0)

Create directory活动是实现这一目标的关键,在此之前,请确保您(您的UiPath)具有用于创建文件夹的 权限 在您的C-Drive和/或D-Drive中(如果您的C-Drive只为您的登录用户读取,则机器人无法执行任何操作)。

我编写了以下简单示例,它对我有用,只需 将它们保存到扩展名为.xaml 的记事本中,然后使用UiPath打开。通过运行它,您的C-Drive和D-Drive都应该使用名为MasterFolderC或MasterFolderD的文件夹创建,下面有3个子文件夹。

希望它有所帮助。

 <Activity mc:Ignorable="sap sap2010 sads" x:Class="Main" mva:VisualBasic.Settings="{x:Null}" sap2010:WorkflowViewState.IdRef="Main_1"
 xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
 xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities"
 xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
 xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
 xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
 xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
 xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
 xmlns:ui="http://schemas.uipath.com/workflow/activities"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <TextExpression.NamespacesForImplementation>
    <sco:Collection x:TypeArguments="x:String">
      <x:String>System.Activities</x:String>
      <x:String>System.Activities.Statements</x:String>
      <x:String>System.Activities.Expressions</x:String>
      <x:String>System.Activities.Validation</x:String>
      <x:String>System.Activities.XamlIntegration</x:String>
      <x:String>Microsoft.VisualBasic</x:String>
      <x:String>Microsoft.VisualBasic.Activities</x:String>
      <x:String>System</x:String>
      <x:String>System.Collections</x:String>
      <x:String>System.Collections.Generic</x:String>
      <x:String>System.Data</x:String>
      <x:String>System.Diagnostics</x:String>
      <x:String>System.Drawing</x:String>
      <x:String>System.IO</x:String>
      <x:String>System.Linq</x:String>
      <x:String>System.Net.Mail</x:String>
      <x:String>System.Xml</x:String>
      <x:String>System.Xml.Linq</x:String>
      <x:String>UiPath.Core</x:String>
      <x:String>UiPath.Core.Activities</x:String>
      <x:String>System.Windows.Markup</x:String>
    </sco:Collection>
  </TextExpression.NamespacesForImplementation>
  <TextExpression.ReferencesForImplementation>
    <sco:Collection x:TypeArguments="AssemblyReference">
      <AssemblyReference>System.Activities</AssemblyReference>
      <AssemblyReference>Microsoft.VisualBasic</AssemblyReference>
      <AssemblyReference>mscorlib</AssemblyReference>
      <AssemblyReference>System.Data</AssemblyReference>
      <AssemblyReference>System</AssemblyReference>
      <AssemblyReference>System.Drawing</AssemblyReference>
      <AssemblyReference>System.Core</AssemblyReference>
      <AssemblyReference>System.Xml</AssemblyReference>
      <AssemblyReference>System.Xml.Linq</AssemblyReference>
      <AssemblyReference>UiPath.Core</AssemblyReference>
      <AssemblyReference>UiPath.Core.Activities</AssemblyReference>
      <AssemblyReference>PresentationFramework</AssemblyReference>
      <AssemblyReference>WindowsBase</AssemblyReference>
      <AssemblyReference>PresentationCore</AssemblyReference>
      <AssemblyReference>System.Xaml</AssemblyReference>
      <AssemblyReference>System.ComponentModel.Composition</AssemblyReference>
      <AssemblyReference>System.ServiceModel</AssemblyReference>
    </sco:Collection>
  </TextExpression.ReferencesForImplementation>
  <Flowchart sap2010:WorkflowViewState.IdRef="Flowchart_1">
    <Flowchart.Variables>
      <Variable x:TypeArguments="x:String" Default="C:\MasterFolderC\" Name="MasterPathC" />
      <Variable x:TypeArguments="x:String" Default="D:\MasterFolderD\" Name="MasterPathD" />
    </Flowchart.Variables>
    <Flowchart.StartNode>
      <FlowStep x:Name="__ReferenceID0" sap2010:WorkflowViewState.IdRef="FlowStep_4">
        <Sequence DisplayName="Creating Folders" sap2010:WorkflowViewState.IdRef="Sequence_3">
          <Sequence DisplayName="C-Drive" sap2010:WorkflowViewState.IdRef="Sequence_4">
            <Sequence.Variables>
              <Variable x:TypeArguments="x:Boolean" Name="pathExist" />
            </Sequence.Variables>
            <ui:PathExists DisplayName="Path exists" Exists="[pathExist]" sap2010:WorkflowViewState.IdRef="PathExists_2" Path="[MasterPathC]" PathType="Folder" />
            <If Condition="[pathExist]" sap2010:WorkflowViewState.IdRef="If_7">
              <If.Then>
                <ui:CreateDirectory ContinueOnError="{x:Null}" DisplayName="Create directory" sap2010:WorkflowViewState.IdRef="CreateDirectory_5" Path="[MasterPathC]" />
              </If.Then>
            </If>
            <ui:CreateDirectory ContinueOnError="{x:Null}" DisplayName="Create directory" sap2010:WorkflowViewState.IdRef="CreateDirectory_6" Path="[MasterPathC + &quot;SubFolder1&quot;]" />
            <ui:CreateDirectory ContinueOnError="{x:Null}" DisplayName="Create directory" sap2010:WorkflowViewState.IdRef="CreateDirectory_7" Path="[MasterPathC + &quot;SubFolder2&quot;]" />
            <ui:CreateDirectory ContinueOnError="{x:Null}" DisplayName="Create directory" sap2010:WorkflowViewState.IdRef="CreateDirectory_8" Path="[MasterPathC + &quot;SubFolder3&quot;]" />
          </Sequence>
          <Sequence DisplayName="D-Drive" sap2010:WorkflowViewState.IdRef="Sequence_5">
            <Sequence.Variables>
              <Variable x:TypeArguments="x:Boolean" Name="pathExist" />
            </Sequence.Variables>
            <ui:PathExists DisplayName="Path exists" Exists="[pathExist]" sap2010:WorkflowViewState.IdRef="PathExists_3" Path="[MasterPathD]" PathType="Folder" />
            <If Condition="[pathExist]" sap2010:WorkflowViewState.IdRef="If_8">
              <If.Then>
                <ui:CreateDirectory ContinueOnError="{x:Null}" DisplayName="Create directory" sap2010:WorkflowViewState.IdRef="CreateDirectory_9" Path="[MasterPathD]" />
              </If.Then>
            </If>
            <ui:CreateDirectory ContinueOnError="{x:Null}" DisplayName="Create directory" sap2010:WorkflowViewState.IdRef="CreateDirectory_10" Path="[MasterPathD + &quot;SubFolder1&quot;]" />
            <ui:CreateDirectory ContinueOnError="{x:Null}" DisplayName="Create directory" sap2010:WorkflowViewState.IdRef="CreateDirectory_11" Path="[MasterPathD + &quot;SubFolder2&quot;]" />
            <ui:CreateDirectory ContinueOnError="{x:Null}" DisplayName="Create directory" sap2010:WorkflowViewState.IdRef="CreateDirectory_12" Path="[MasterPathD + &quot;SubFolder3&quot;]" />
          </Sequence>
        </Sequence>
      </FlowStep>
    </Flowchart.StartNode>
    <x:Reference>__ReferenceID0</x:Reference>
    <sads:DebugSymbol.Symbol>dzFDOlxVc2Vyc1xtbWlhb1xEZXNrdG9wXFRlc3RpbmdXb3JrcGxhY2VcTWFpbi54YW1sIDsDZA8CAQE9ND1HAgEDPjQ+RwIBAkIJXxQCAQRDC1AWAgEaUQteFgIBBUcNR6MBAgEqSA1MEgIBJE0NTb8BAgEhTg1OvwECAR5PDU+/AQIBG1UNVaMBAgEVVg1aEgIBD1sNW8ABAgEMXA1cwAECAQldDV3AAQIBBkc9R0oCAS1Hf0eOAQIBK0gbSCgCASVKEUqqAQIBJ02UAU28AQIBIk6UAU68AQIBH0+UAU+8AQIBHFU9VUoCARhVf1WOAQIBFlYbVigCARBYEViqAQIBEluVAVu9AQIBDVyVAVy9AQIBCl2VAV29AQIBB0qYAUqnAQIBKFiYAVinAQIBEw==</sads:DebugSymbol.Symbol>
  </Flowchart>
  <sap2010:WorkflowViewState.ViewStateManager>
    <sap2010:ViewStateManager>
      <sap2010:ViewStateData Id="PathExists_2" sap:VirtualizedContainerService.HintSize="464,89" />
      <sap2010:ViewStateData Id="CreateDirectory_5" sap:VirtualizedContainerService.HintSize="200,22" />
      <sap2010:ViewStateData Id="If_7" sap:VirtualizedContainerService.HintSize="464,208" />
      <sap2010:ViewStateData Id="CreateDirectory_6" sap:VirtualizedContainerService.HintSize="464,22" />
      <sap2010:ViewStateData Id="CreateDirectory_7" sap:VirtualizedContainerService.HintSize="464,22" />
      <sap2010:ViewStateData Id="CreateDirectory_8" sap:VirtualizedContainerService.HintSize="464,22" />
      <sap2010:ViewStateData Id="Sequence_4" sap:VirtualizedContainerService.HintSize="200,51">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">False</x:Boolean>
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="PathExists_3" sap:VirtualizedContainerService.HintSize="464,89" />
      <sap2010:ViewStateData Id="CreateDirectory_9" sap:VirtualizedContainerService.HintSize="200,22" />
      <sap2010:ViewStateData Id="If_8" sap:VirtualizedContainerService.HintSize="464,208" />
      <sap2010:ViewStateData Id="CreateDirectory_10" sap:VirtualizedContainerService.HintSize="464,22" />
      <sap2010:ViewStateData Id="CreateDirectory_11" sap:VirtualizedContainerService.HintSize="464,22" />
      <sap2010:ViewStateData Id="CreateDirectory_12" sap:VirtualizedContainerService.HintSize="464,22" />
      <sap2010:ViewStateData Id="Sequence_5" sap:VirtualizedContainerService.HintSize="200,51">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">False</x:Boolean>
            <x:Boolean x:Key="IsPinned">False</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="Sequence_3" sap:VirtualizedContainerService.HintSize="222,266">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="FlowStep_4">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <av:Point x:Key="ShapeLocation">200,127.5</av:Point>
            <av:Size x:Key="ShapeSize">200,51</av:Size>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="Flowchart_1" sap:VirtualizedContainerService.HintSize="614,636">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">False</x:Boolean>
            <av:Point x:Key="ShapeLocation">270,2.5</av:Point>
            <av:Size x:Key="ShapeSize">60,75</av:Size>
            <av:PointCollection x:Key="ConnectorLocation">300,77.5 300,127.5</av:PointCollection>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="Main_1" sap:VirtualizedContainerService.HintSize="654,716" />
    </sap2010:ViewStateManager>
  </sap2010:WorkflowViewState.ViewStateManager>
</Activity>