While moving pdf files from downloads to new flder all files except the last downloaded(like some time its two and sometime more then 2)

1.Downloaded multiple pdf files(.pdf) from web portal - success
2.Moved the recently downloaded pdf(its 2 or more then2 ) files to a new folder using for Each loop- unsuccessful
note. in downloaded pdf folder some other pdf is also available but i need just move downloaded pdf files.

Hii @rAE_rAS ,

To move the recent downloaded file from one folder to another,
we can compare the datetime modification of the pdf file with current
datetime.
Apply if condition for the same.

Regards,
Ayushi Jain

can you say with example in details please.

To check pdf is downloaded in an hour,
a.) apply if condition:-
DateDiff(DateInterval.Hour,DateTime.ParseExact(PDFCreatedDate.ToString,“MM/dd/yyyyHH:mm”,System.Globalization.CultureInfo.InvariantCulture),DateTime.now())=1
where PDFCreatedDate is string variable containing the pdf creation date.

b.)then move file from one folder to another.

Note:- PDF creation can be fetched from the date modified section in downloads folder.

Regards,
Ayushi

its possible if i can put in date only Today?

Yes, for this apply if condition
DateDiff(DateInterval.Day, DateTime.ParseExact(PDFCreatedDate.ToString, “MM/dd/yyyyHH:mm”, System.Globalization.CultureInfo.InvariantCulture),DateTime.now())=0

Hope this helps.
Regards,
Ayushi

when i used today inplace pdfcreated date and its show irrelevent date error in automation

image

Instead of today, get date modified for each file in folder using get text, and compare with current date.
DateDiff(DateInterval.Day, DateTime.ParseExact(PDFCreatedDate.ToString, “MM/dd/yyyy hh:mm”, System.Globalization.CultureInfo.InvariantCulture),DateTime.now())=0

Hope this helps.
Regards,
Ayushi

But I need without human input run this boat daily so, if i add today date then its not working tomorrow

You need to move recent downloaded files to another folder right?

yes…only downloaded pdf files…because in that folder other pdf is also available.

Yes, so for moving recent files to another folder,
we need to check that files are of current date and for this, we can get the pdf creation date and compare with current date

i cant understand please give me some brief overview

Follow the steps:-

a.)Apply loop for each file in folder
b.)Use Get text activity for fetching pdf creation date.
c.)Apply if condition and condition to verify that files have been recently downloaded.
DateDiff(DateInterval.Day, DateTime.ParseExact(PDFCreatedDate.ToString, “MM/dd/yyyy hh:mm”, System.Globalization.CultureInfo.InvariantCulture),DateTime.now())=0
d.) If above condition is true, move files to another folder

Hope it helps.
Regards,
Ayushi

Thank you its working.

HI,

…why don’t you download PDF files directly where you want, let say “MyPDFDownloadFolder” or the final folder where you want to move these files?

Because that is not our client requirement.

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