Create Folder precheck?

Hi,

Does the Create Folder activity do some form av precheck before creating a folder.

Lets say I use the Create Folder activity and I pass this to the input:

C:\Folder1\Folder2\Folder3\Folder4\Folder5

If “Folder1” and “Folder2” exists will it create a “copy(1)” or overwrite it or will it ignore to create “Folder1” and “Folder2” and just create “Folder3”, “Folder4” and “Folder5”?

Dont really want it to make a mess of my paths and such.

Hi @atomic

Use Path Exists Activity and select the type to folder !

Say If In path exists activity give the full folder1 path

C:\Folder1 in Path exists activity if exists then do nothing or else create folder2 in else part!

Regards

I just tried to use the Create Folder Activity and it seems that it doesnt overwrite folders that already exists.

I guess Path Exists does not need to be used here.

It seems that I can do like this:

Create Folder activity: C:\Folder1\Folder2\Folder3\Folder4\Folder5\test1

Create Folder activity: C:\Folder1\Folder2\Folder3\Folder4\Folder5\test2

Create Folder activity: C:\Folder1\Folder2\Folder3\Folder4\Folder5\test3

It doesnt overwrite the Folders. I’m just a little bit scared if it can make a mess later on.
Why even use Path Exists activity in this scenario or is it used for something else?

@atomic

For this, you first use Path Exists and check whether the folder is created or not

Use If condition If pathExists variable becomes false then place Create Folder activity and define that activity

If the PathExists variable is True then leave blank to go to next activity

Hope this may help you

Thanks

Yeah, if you check my comment above yours it seems like the Create Folder activity can handle it.

I mean the Path Exists activity seems pointless in this case.

Cant figure out the logic. The worst that can happen is that it combines the folders?

Fine lets go one by one

  1. Folder 1 and folder 2 if exists, it will overwrite

for example if i have a already existing folder
“C:\Users\palan\Desktop\Folder1\Folder2\Folder3\Folder4\Folder5\test”

and if i mention the same in CREATE FOLDER activity as input, then it will not overwrite nor recreate the existing folder
it will leave as it is.

if we mention a different folder name atlast like this
“C:\Users\palan\Desktop\Folder1\Folder2\Folder3\Folder4\Folder5\test_1”

then it will create a new one.

suppose if you dont have any of the subfolders along the path, that is here
“C:\Users\palan\Desktop\Folder1\Folder2\Folder3\Folder4\Folder5\test”
if we miss FOLDER1 and mentioned in input, then it will create from folder1
from Folder1\Folder2\Folder3\Folder4\Folder5\test it wont throw any error
it will still create the folder structure newly

hope this would help you and as you said no need of PATH EXISTS here when you are using CREATE FOLDER.

Cheers @atomic

1 Like

I think im confusing myself.

I tried this:
image
Then I created a text document
image
I then did this again:
image

It did not overwrite anything.

I could for example run this:image
And the folders would not get replaced.

Im so confused haha.

i was mentioning completely for folder creation and if it is with Files, then as you said it wont overwrite.

but if it is only folders then it wont overwrite if the folder already exists

as simple as it is

Cheers @atomic

1 Like

This part im not really following.

I ran the activity image
with only folders no files inside any of the folder.
And the test 4 is not overwritten.

I am overthinking it probably haha.

well i just checked again and validated with time when the file was last created

to be exact, if the folder already exists then it is overwriting rather it is leaving as it is as the folder exists

say for example
i created this folder for first time
“C:\Users\palan\Desktop\Folder1\Folder2\Folder3\Folder4\Folder5\test”
around 20:05 and once after running i saw the folder creation time as same 20:05

again i kept this string as input and tried to run CREATE FOLDER around 20:06
and when i ran it was still showing only 20:05 which means folder is not recreated nor overwritten

hope its clear now on this part. i have updated my previous comment as well

Cheers @atomic

1 Like

Thank you.

This means that the “Create Folder” Activity is “smart” and cant really mess up the folders in a path.

To simplify it. “Create Folder” does not replace or overwrite already existing folders. Can we agree on this?

And then the question is, what is the point of the “path exists” activity other the using it in special scenarios.
I mean one does not really need to use path exists to verify if a folder exist before creating a a new one or the same folder again because it does not overwrite it?

I have also played with the “ContinueOnError” setting in the Create Folder activity and I cant really see any difference when it is checked/unchecked or when it has the default setting.

Kind Regards
atomic

Fine

lets go one by one

PATH EXISTS is usually used when someone wants to validate whether a folder exists or not before creating it and it is applicable for both files and folders as well. And it depends on scenario, say for example if someone wants to fetch a file from folder once after that file is downloaded but would like to validate whther the file is there or not, there comes PATH EXISTS

or if someone wants to see if folder exists first or if not will need to send a mail or need to log that as a log message, then a boolean value is needed which is given only with PATH EXISTS activity

and for continuous on error, usually it has to be used if you are not surrounding the activity within TRY CATCH to ensure that bot executes fine even if that CREATE FOLDER Activity fails
and it would fail in case like suddenly your access to create a new folder is denied in the folder structure where you are trying. Then bot will throw an error and it makes a difference there on checking that option

Cheers @atomic

1 Like

Thank you for the explanation.

The things that confused me was reading the first comments and the suggestions to use the path exists in my case.

Create folder is sufficient it seems. Create Folder can even create multiple subfolders in the same activity.

Like this: c:\test1\test2\test3
If test2 and test3 does not exist it would create them at the same time. This is maybe off topic but still.

Thank you for your time!

1 Like

exactly
@atomic

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