Folderpath

Hi all,
I am stuck in one place, please help me.
I have a folder with name as follows
_dd-MMM-yy_HH-mm
Date and time will be bot rundate and time.
How to check if that folder exists or not.

Please help me

Hi @0bb4628e217fd43ac86ac9294

=> Use Folder Exists and give the below path. Change the path according to yours and save the output to a variable say FolderExists.
Folder Path:Path.Combine("C:\","XYZ_"+Now.ToString("dd-MMM-yy_HH-mm"))

=> Us an If condition and give below way:

If
  FolderExists
Then
    \\Do Nothing
Else
    Create Folder Activity
      Folder Name: Path.Combine("C:\","XYZ_"+Now.ToString("dd-MMM-yy_HH-mm"))
End If

If this exists it won’t create a folder if not it will create a folder at run time. Change XYZ with your required Folder Name and change C:\ according to yours accordingly.

Hope it helps!!

My input files are there in this folder
Example _14-Mar-24_12-02 12-02 is the time which varies everytime we place the input files to this folder

@0bb4628e217fd43ac86ac9294

Do you want to check if the folder exists do the further process or stop the bot, in that way. Please specify

Regards

Try to get file of the parent Folder of ur Example _14-Mar-24_12-02 12-02 using the following:

FileList = Directory.GetDirectories("YourParentDirectory").ToList

Where FileList type - List
It will give you all the folder that are present in the YourParentDirectory of Example _14-Mar-24_12-02 12-02. And you can use accordingly.
Take a look at this:

Cheers!!!

we would like to point out:
when using the DateTime.Now within the existence check, then only a timeslot of max.1 minute is available for the check

Maybe you can elaborate more on this.

Kindly note as well:
Example: Now is 14:15:59 (HH:mm:ss) then for a check involving a now Statement only 1 second rests as with: 14:15:59 +1sec = 14:16:00 which results to 14:15 is not 14:16

Date and time keeps varying everytime like if I am running the bot now then date will be _14-Mar-24_14:45

Hi @0bb4628e217fd43ac86ac9294

=> Use Folder Exists and give the below path. Change the path according to yours and save the output to a variable say FolderExists. Give the below expression in Folder Path.

Folder Path: Path.Combine("C:\", "Example_" + Now.ToString("dd-MMM-yy_HH:mm"))

=> Us an If condition and give below way:

If
  FolderExists
Then
    \\Do Nothing
Else
    Create Folder Activity
      Folder Name: Path.Combine("C:\", "Example_" + Now.ToString("dd-MMM-yy_HH-mm"))
End If


Hope it helps!!