Extension and naming of a file

uiautomation
studio

#1

Hi,

I have a List AvailableFileList which contains digital*.pdf,digital*.docx,digital*.csv, pricing*.pdf,pricing*.docx,pricing*.csv Files.
Now i have a directory which conatins many files around 1000 Files. i have to extract only those Files from here which has AvailableFileList strings i.e, anyfile which has written digital and either (.pdf/.docx /.csv.) or Pricing (.pdf/ .csv /.docx)
How can i do the same.
I have created a logic which is not working.


#2

Hi @aamir,

I have not tried this using UiPath.
However, we can do following steps:

  1. window buton +R (Hotkeys)
  2. type “cmd” and enter (typeinto activity)
  3. type cd the directory path (typeinto activity)
  4. type “dir *.docx” (typeinto activity)
  5. the file will be listed having .docx extension (use scrapping to extract the required info or copy text)

Let me know if this helps.


#3

Hi priyank,

Thanks for your help. I have created a workflow if you want i can send you what i have done is first it checks if that directory contains any .pdf,.csv,.docx file it sends to a temporary directory and then again i hv created a loop in which it is checking in that temporary directory any name with digital or pricing.
However i am able to move the files containing extension .pdf, .csv, .docx in temp directory but i am failing to move from temporary directory those files containing digital pricing.
Can you help me in this if i sent you my workflow.


#4

Sure send the workflow. I will try my best to help you.


#5

Main.xaml (49.9 KB)


#6

and here i have used a .csv Files
which contains Columns 1.Contains Strings(values Digital,Pricing) and
2.Extensions(values .pdf,.csv,.docx)
3.SourcePath(" somepath") directory where all the files are stored in it.
4.Temporary Path("somepath ") directory where all files are getting stored here.


#7

What is "y"
here
y < ContainsExtensionCounts


#8

here y is a variable of int type contains value 0.


#9

Basically, you are saying that the logic is working till you have the data in the temporary dir i.e. "D:\Backup Files"
Now after this you want to have separate dir for digital files and other for pricing files?


#10

Yes.
from D directory now i want to move any file with a name digital or pricing to separate folder name digital and pricing.
Please help me in this i am not able to do it.


#11

sure let me think on the logic …till then…
Can I suggest you to please try the below steps in uipath.

window buton +R (Hotkeys)
type “cmd” and enter (typeinto activity)
type “cd D:\Backup Files” (typeinto activity)
type “dir pricing*” (typeinto activity)
type “move pricing* D:\PricingFiles” (typeinto activity)

If this works for you.


#12

Hi,

I tried the one which you said but unfortunately its not working


#13

Hello @aamir
Sequence:Moving files back to source Drive – Activity:Move file
you are not passing the file name in destination field


#14

Not working in the sense you are not able to achieve what you wanted to from the below logic.

As I have tried to simulate the steps in UiPath and is working perfectly fine. It is moving all file with the string like pricing is moving to destination dir.

window buton +R (Hotkeys)
type “cmd” and enter (typeinto activity)
type “cd D:\Backup Files” (typeinto activity)
type “dir pricing*” (typeinto activity)
type “move pricing* D:\PricingFiles” (typeinto activity)

the is working.
PFA the workflow.
Main.xaml (8.3 KB)


#15

Hi,

I am passing it to destination field. i am attaching you the screenshot.


#16

use below it will work:

"C:\Users\aamir\Desktop\Updated Files\" & Path.GetFileName(File1.ToString)"

you are missing file name in destination field.