How to split one text file into multiple text files according to text content?

Hi,

First set variable like strBasePath ="c:\Desktop"

Then can you replace System.Environemnt.CurrentDirectory with strBasePath in the above workflow?

Regards,

1 Like

Hi, Yoichi.

I have amended the variable path & is working.

Folder created successfully:
image

Thank you so much for the help :grinning: :+1:

1 Like

Hi.

How to edit the add another folder with another date within the same month?
Like below:
image
Because when i run the script-Sample20221117-4v5.zip, there is error message.

Hi,

Can you elaborate? Which path do you want to write it to?

Regards,

Hi,

Currently, I generated text file & create this folder:
\2022 Nov\20221115 based on the date in text file:
image

But if i have another date in another text file:
image
How to create add \20221129 in folder at \2022 Nov?

so it will become like this:
image

HI,

In the above sample. there is logic to create yyyy MMM style folder (like 2022 Nov) then create yyyyMMdd style folder (like 20221115).
If you want to change the base folder, please replace the following Ssytem.Environment.CurrentDirectory with another folder.

image

Regards,

Hihi.

Actually, I do not want to change the base folder (2022 Nov), but overwrite 2022 Nov to add sub folder 20221129.

I tried to upload these 2 text files & has error messages:


abc.txt (2.8 KB)
abc1.txt (2.8 KB)

Base folder should be parent folder of 2022 Nov.
If it’s c:\temp\temp\2022 Nov, base folder is c:\temp\temp

image

Can you try to set it?

Regards,

Hihi.

Still unable to do it.
But I modify this way by adding this:


Not sure whether is this the correct way? By using this way, no matter how many times I overwrite abc.txt file with another date inside. It will auto create a yyyymmdd folder in \2022 Nov.

Maybe you can take a look:
Sample20221117-4v5.zip (104.3 KB)

Hi,

It’s necessary to put PathExists activity at the following red arrow point.

Regards,