I am downloading a file from google drive and uploading it to another website.
I have applied forever while loop because as soon a file is modified it will download that file and upload to the website.
I have applied another condition that if in case the file is modified in last 10 minutes it will take that file only. But lets say if there are 3 files which were modified in the last 10 minutes, it keeps on downloading those files again and again and uploads on the website.
Can anyone help me with the logic that if a particular file of a particular time stamp has been downloaded from the drive, it does not download that file again.
Here you can create a short data table, the information contains a data like file_name or anything to match with current data, so if the first loop is finished, in the second loop it will check in data table whether the file exist.
if file exist is true, skip to further to other process else download the file.
Can you please elaborate the steps…a bit confused how to go about it
Can you share sample project file here or screenshots.
There are basically 70 CSV files in a folder in Drive. I have taken Gsuite in a forever while loop.
I check the modified time for each of those sheets. IWhile iterating for each sheet, If the sheet was modified in say last 10 mins. The bot downloads that sheet to the computer and then uploads that same sheet to the website where i want it uploaded. But it uploads the same file again and again since it is in an infinite while loop.
writeline activity sheet modified time and now.addmintues(-10)
Check the values and compare it first manually
yes i have tested this…the condition works fine…if the sheet was modified more than 10 mins ago…it does not pick that sheet
Can you please share screenshot of inside assign activity convert.todatetime whole body.
Please try below method
1st convert your sheet_modified_date = cdate(yourvar).tostring(“dd MMM yyyy HH:mm:ss”)
2nd current_date_time = DateTime.Now.ToString(“dd/MM/yyyy HH:mm:ss”)
3rd assign difference = current_date_time - sheet_modified_date
if difference >= 10
should i compare both of them as a string?
Yes, both var will be as string and make sure date format should be 19-02-2022 04:06:05 date/month/year hour: minutes:seconds for both variable and subtract them
i’m sorry but this is very confusing…okay i have done as you asked…what will happen by this?
it will create time difference and if the difference between time is 10 mins then apply your condition. less or below whatever.
okay so basically i should apply my if condition in this condition?
And how will this prevent the bot from downloading the same file again when the while loop repeats? please explain ?
I have tried earlier in my project on time comparison, it worked well for me…
if condition meets, bot will not enter the if condition where you don’t want to download the file.
Have you try?
here is screenshot of my project.
Thanks! I’ll definitely try it
Hi @Yogesh1 , this is taking the file again and again because it is in a forever while loop so for the second time it again takes it…I have thought of many ways but couldn’t find any…is there any other way?
One way could be, if you can take the file name and store in datatable creating one variable.
now match the name in loop and skip if the file already available.