Selecting File # According to Day of month

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
wvfrugalchick
Newbie
Posts: 15
Joined: Sun Jul 23, 2023 4:57 pm

Selecting File # According to Day of month

Post by wvfrugalchick » Tue Oct 29, 2024 5:34 pm

Non-techie here, learning as I go.

1) My files are in C:/Receipts/
2) Each file is numbered 1-31

I need ms to go into the folder, select the numbered file according to todays date and upload it to my main backup. Can anyone show me what that would look like? Please and Thank you

wvfrugalchick
Newbie
Posts: 15
Joined: Sun Jul 23, 2023 4:57 pm

Re: Selecting File # According to Day of month

Post by wvfrugalchick » Tue Oct 29, 2024 5:39 pm

I tried this, but Its not working

//Get the date
GetDate>TheDate
//Separate out all the parts
Separate>TheDate,/,DateParts
//Get the mm,dd, and yyyy
Let>dd=DateParts_1


Let>DateString=%dd%
//Set the path to your file
Let>FilePath=C:\receipts\%DateString%.jpg

* Yes! Im in over my head. My brain is not wrapping around this

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1414
Joined: Sun Nov 03, 2002 3:19 am

Re: Selecting File # According to Day of month

Post by Dorian (MJT support) » Wed Nov 27, 2024 11:39 am

Apologies for the slow reply - this one slipped through the net.

Depending on your time format, that might return the month. If your system is using the USA date format it returns C:\receipts\11.jpg

UK format returns C:\receipts\27.jpg

If this is what's happening there are a couple of ways of fixing it :

1: Either use Let>dd=DateParts_2 instead of Let>dd=DateParts_1

2: Use Day instead of GetDate :

Code: Select all

//Get the date
Day>DateString
//Set the path to your file
Let>FilePath=C:\receipts\%DateString%.jpg
However, the second method will return 01,02,03 etc for the single digit dates. If you require it to be 1,2,3, etc you can use Format :

Code: Select all

//Get the date
Day>DateString

//Format single digit dates
If>DateString<10
  Format>%.1d,DateString,DateString
Endif

//Set the path to your file
Let>FilePath=C:\receipts\%DateString%.jpg


Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts