English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System > Coders. Scripting

 
 
Thread Tools
Old 19 May 2020, 14:18   #1
quantum8
Registered User

 
Join Date: Jun 2019
Location: BNE AU
Posts: 158
AmigaDOS compare two dates

I'm writing a script and am wondering if there's a command/tool that converts two strings to dates to compare and return the result for the newest one.


The type of result I'm after looks similar to the pseudo below



Code:
IF "19-Jan-17" GT "10-Jun-17"
 echo "file 19-Dec-17 is greater than 10-Jun-17"
ELSE
 echo "file is older, doing nothing"
ENDIF
quantum8 is offline  
Old 19 May 2020, 16:24   #2
Exodous
Registered User

 
Join Date: Sep 2019
Location: Leicester / England
Posts: 54
Is this for copying files?

If so, take a look at COPY NEWER

https://wiki.amigaos.net/wiki/AmigaO...Reference#COPY


"NEWER Overwrite files only if the destination file is older than the source file or if there is no destination file by the same name as the source file."
Exodous is offline  
Old 20 May 2020, 01:01   #3
quantum8
Registered User

 
Join Date: Jun 2019
Location: BNE AU
Posts: 158
It's for copying files and then extracting them, so I want to be able to compare the date of the archived file, as generated by the LIST command, with the a file in the unarchived directory, or with a specified date string.

I know in linux I can use "date -d $DATEVARIABLE +%s" for each date parameter and compare the two after that, but it seems I have to convert the default Amiga string DD-MMM-YY into a number format such as YY-MM-DD before I can do a direct comparison.
quantum8 is offline  
Old 20 May 2020, 02:01   #4
quantum8
Registered User

 
Join Date: Jun 2019
Location: BNE AU
Posts: 158
I found a way simple way around it by using the SINCE option in the LIST command.

There's a lot for me to learn in Amiga scripting!
quantum8 is offline  
Old 20 May 2020, 12:12   #5
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 2,565
Amiga DOS is very limited. If you want to do something more advanced you soon start to search for a better solution because it will become complicated and workarounds are needed. A more comfortable way is to use ARexx instead.
daxb is offline  
Old 21 May 2020, 13:15   #6
quantum8
Registered User

 
Join Date: Jun 2019
Location: BNE AU
Posts: 158
For what I'm wanting to do it doesn't seem too bad. Especially easier after I kit it out with some standard UNIX commands like sed and cut.
quantum8 is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Factor 5 dates Predseda HOL data problems 2 12 January 2016 12:57
Dates mritter0 New to Emulation or Amiga scene 5 23 November 2014 13:30
Disk \ ADF Compare felixkat request.Apps 18 30 November 2013 19:53
KyroFlux - How might it compare to the CatWeasel? Narf the Mouse project.SPS (was CAPS) 10 28 May 2011 20:19
What version of DX did the AGA compare to? methodman Retrogaming General Discussion 8 22 May 2010 09:02

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 00:34.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.07275 seconds with 14 queries