Showing results for 
Search instead for 
Did you mean: 

Automated File path change during operation

Go to solution

@Ziadeh wrote:

First off I want to apologize, im sure there are way more pertinent or interesting questions out there than this, but if you would be so kind to help me just a little bit more.

That's perfectly OK. If we don't want to, we won't help. But it's amazing what one can learn from seemingly trivial questions and trying to answer them. They're usually not that trivial at all. 


@Ziadeh wrote:

In my initial post I mentioned dropping the data into separate folders however im perfectly ok with having one folder with multiple CSVs that represent each day. It seems by doing it this way I can have a constant file path and just create the files using your portion. 

If the string that builds the path has folders in it, I think you'd automatically get folders.


So "file.txt" adds a file name, "folder\file.txt" will add folder and file. But you have to actually strip the path, and use the folder path with Create Folder. This will give an error if the folder is already there, and then the error can be ignored. Some care should be taken to ignore only that error.


Usually, all daily files in monthly folders, or hourly files in daily folders, etc. works quite nice. Each file in it's own folder adds very little.


@Ziadeh wrote:

Where I need help is locating where  to put your portion in relation to the while loop that will constantly be running. If it is outside, the path only gets created once, if its inside it will get created every iteration which overwrites the previous iteration. I have tried to put a case structure inside the while loop that compares the initial date to a constantly changing date and if they are not equal then it runs the portion you suggested, however I was struggling to get anything that would accomplish the task.

That is on the right track.


However, you can't check the time, because that changes all the time.


In stead, you should check the resulting file path (EDIT: UNTESTED!):

New Daily File.png


The shift registers are key here. If you haven't met them before, make sure you have a proper understanding of them. It's almost impossible to properly make anything non-trivial without them. The result is usually improper code, and we see that all the time.

Message 11 of 11