19 May 2020, 14:18 | #1 |
Registered User
Join Date: Jun 2019
Location: BNE AU
Posts: 216
|
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 |
19 May 2020, 16:24 | #2 |
Registered User
Join Date: Sep 2019
Location: Leicester / England
Posts: 201
|
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." |
20 May 2020, 01:01 | #3 |
Registered User
Join Date: Jun 2019
Location: BNE AU
Posts: 216
|
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. |
20 May 2020, 02:01 | #4 |
Registered User
Join Date: Jun 2019
Location: BNE AU
Posts: 216
|
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! |
20 May 2020, 12:12 | #5 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,304
|
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.
|
21 May 2020, 13:15 | #6 |
Registered User
Join Date: Jun 2019
Location: BNE AU
Posts: 216
|
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.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Disk \ ADF Compare | felixkat | request.Apps | 46 | 28 March 2021 00:00 |
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 |
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 |
|
|