Filename condition

Hii,
I have files with the name as “casenumber+date” which is stored in a folder
now i have to check in the folder whether the file with name only “casenumber” refinning on ony casenumber is the condition exist .if exist the copy to other folder.

Thanks and Regards,
Supriya

@supu123

As per my understanding, Folder contains both types files like casenumber+date and casenumber.

Are you trying to move the files which contains casenumber only ? Am I right ?

You can use

Directory.GetFiles(“path”) to get all the file names in that specified folder.
Loop through all the files
For each file, check whether the name contains “casenumber”, condition can be checked through IF
If matches, use Copy File to copy the file to another folder.

Hi @supu123

I have a sample workflow for you to support this task of yours. Check this out and see whether it works for you…

It gets the list of files available in a specified folder. Then it checks for a casenumber which I have hard coded and the file name has that value in it. If the condition is true, it moves the file.

CheckForFilesAndMove.xaml (6.2 KB)

Let know if this works for you!!

You can check using if condition
path.Exists("C:\Users\VirajN\Folder"+casenumber"".pdf)

True> file exists.
False> file not exists

If True
Move file activity to move the file from one folder to another folder

Hii @lakshman
filename is supu-02-12-2019 and i have to check in the folder whether supu-02-12-2019 exists in the folder depending on only supu

Thanks and Regrads,
Supriya

@supu123

I have some doubts. Here, Casenumber is unique or not.

And also Is there multiple files exists with same casenumber like:

case123456-02-12-2019

case123456-04-12-2019

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