Doubt on a workflow - Suggestions needed

Hi ,

Am trying to do a simple workflow.

  1. pick a set of files from a folder with todays date (where multiple files with different dates are available).
  2. upload to some web portal - which will give me a summary of each file stating “updated successfully” along with the file name (say if i have 50 files with name File 1, File 2,… File 50. I would be getting status for each file)
  3. Need to identify the name and its status … if the status is SUCCESS in the portal, I need to move those file names from the Folder to another folder called “SUCCESS” folder.

Your thoughts and simplest way of advice would help me much here.

Hi,

Here would be my approach - code/pseudocode:

filelist<String[]> = System.IO.Directory.GetFiles(directorypath).Where(Function(f) Path.GetFileName(f.ToString).Contains(Now.ToString("MM-dd-yyyy"))).ToArray   // store to Array of strings

For each file In filelist   // TypeArgument set to String
    Process upload file.ToString to web portal
    GetText of status
    If text.ToUpper.Contains("SUCCESS")
        Move File activity   // from file.ToString to Path.Combine(successDirectory,Path.GetFilename(file.ToString)))

The first step was to store your list of files to process for today’s date (assuming that was your goal).

Sorry I could not provide better ideas for the upload part or GetText part since it relies on the functionality of the portal.

Hopefully this is helpful.

Regards.

Thanks @ClaytonM. just one clarification… in ur code, i could see that to get the files directory path. Here is my situation… I will be getting the status of the file in a tabular format… like with the file name and the status.

For eg. i am uploading the File A from /desktop/KK-test/rough/FileA.pdf and File B etc… once its uploaded, the result would be displayed in a table as File A - succesfully uploaded and File B - upload failed.

I have to check the time of File A (say if its 9.30 AM) and need to compare with the system time… (say its 4.30 PM). if the file time is greater than 4 hours of system time i need to move that file A to a different folder. Is this possible? can you help me to get the file time and compare with system time?

Hi @kk.virags

So, I put this in quick to show how you can check a difference in time.
this will give you creation time: System.IO.Directory.GetCreationTime()
then, also set a System.Timespan variable, like 04:00:00

You can do this inside the ForEach, so it does it for each file:
image

You can also use .GetCreationTime or .GetLastAccessTime

I hope this helps.

Regards.