Amiga.org

Amiga computer related discussion => Amiga Software Issues and Discussion => Topic started by: Orphan264 on January 28, 2020, 02:11:15 PM

Title: drawer named from date
Post by: Orphan264 on January 28, 2020, 02:11:15 PM
Looking for assistance with a script - I want to create a drawer named from the date. I am using OS 3.1.4.1

For example - today is January 28, 2020. I want the script to create a drawer named for the ANSI date such as
2020-01-28

Where do I begin? I appreciate the help.

Title: Re: drawer named from date
Post by: TribbleSmasher on January 28, 2020, 06:28:53 PM
Either you make a little script that takes an argument or something like this.

Code: [Select]
c:makedir `c:date`Dunno if this works everytime.
Title: Re: drawer named from date
Post by: Orphan264 on January 29, 2020, 01:15:39 PM
Thanks, I will try that and see what I have.
Title: Re: drawer named from date
Post by: kolla on January 29, 2020, 03:14:58 PM
Yeah, dream on :)

You wish to format the output of C:Date, but VERY SADLY, C:Date does not support that, so you have to jump through hoops around the problem.

Code: [Select]
Echo to T:timestamp
Makedir `List DATES T:timestamp LFORMAT %D`
Delete T:timestamp QUIET

This creates a temporary file, which you then can list with LDORMAT %D to get the date from, but you need "DATES" parameter or it will always say "Today", and then make a directory with this name - also SADLY it will be 29-Jan-20 and not 29-01-2020, and there is little you can do about that, and also this output depends on locale, so in case of the month of May, a system with English locale will for example say "29-May-20", while with Norwegian locales will say "29-Mai-20" and Swedish "29-Maj-20" etc.

If you think that this is all crazy and should be corrected, you can join my whining choir...
Title: Re: drawer named from date
Post by: nbache on January 29, 2020, 03:17:14 PM
With OS4, you can do

Code: [Select]
makedir `date lformat %Y-%m-%d`
Not sure if your version of C:Date has the LFORMAT argument.

Edit: Seems not, according to Kolla's post above. Sorry.

Best regards,

Niels
Title: Re: drawer named from date
Post by: TribbleSmasher on January 29, 2020, 06:09:08 PM
Shouldn't be that hard to find another date alike tool that just outputs the date without locale messing it up.

http://aminet.net/package/util/cli/fdate
Title: Re: drawer named from date
Post by: TribbleSmasher on February 01, 2020, 03:36:59 AM
Or, use this one.
It is a quick&dirty example.

For sorting purposes you might want to use option 'a', which fits best.

Unfortunately, AMIGA forum does not allow LHA attachments.
Title: Re: drawer named from date
Post by: kolla on February 01, 2020, 11:22:23 AM
Huh, why resort to third party software - even though AmigaDOS date is tedious in all kinds of ways, ARexx DATE works fine, for example
Code: [Select]
Makedir `rx “SAY DATE(S)”` may be good enough, it makes a 20200201 directory today.
Title: Re: drawer named from date
Post by: TribbleSmasher on February 01, 2020, 11:24:36 AM
A thirdparty tool is as good as a dependency on AREXX, but i like any different solution of course. :)
Title: Re: drawer named from date
Post by: kolla on February 01, 2020, 12:41:11 PM
A thirdparty tool is as good as a dependency on AREXX, but i like any different solution of course. :)

The problem is that over time, your path fills up with a range of third party tools that you no longer have any idea where they came from or what they really do :)  ARexx you can count on being there, and it's in general a better choice for scripting.

Btw - if anyone feel like reporting an OS bug... well, ARexx bug - DATE(CENTURY) is supposed to return the number of days in this century, but it really looks more like the number of days since 01-01-1900, and not since 01-01-2000. So it's really a "Y2K" bug.
Title: Re: drawer named from date
Post by: TribbleSmasher on February 01, 2020, 05:33:09 PM
I used to add several 'c' directories onto my system drive which are late-assigned to C: during startup.
This way i have a rather small C: (or sys:C/) but all my (de)crunchers are in sys:c3/, my own tools are in sys:c_plus/ and so on but they are still reachable from the path.

A thirdparty tool is as good as a dependency on AREXX, but i like any different solution of course. :)

The problem is that over time, your path fills up with a range of third party tools that you no longer have any idea where they came from or what they really do :) 
Title: Re: drawer named from date
Post by: nbache on February 01, 2020, 07:22:48 PM
I used to add several 'c' directories onto my system drive which are late-assigned to C: during startup.
This way i have a rather small C: (or sys:C/) but all my (de)crunchers are in sys:c3/, my own tools are in sys:c_plus/ and so on but they are still reachable from the path.
I once did that too. One downside of that is that when you install updates to the system components, or vice versa to the third party tools, you may be surprised by where they end up. In practice, I would end up installing everything by hand, even when it had installation scripts.

Best regards,

Niels
Title: Re: drawer named from date
Post by: TribbleSmasher on February 01, 2020, 08:30:20 PM
In practice, I would end up installing everything by hand, even when it had installation scripts.
Niels
Sure, but isn't that the fun of being able to do just that on Amiga? ;D
Title: Re: drawer named from date
Post by: nbache on February 01, 2020, 10:20:29 PM
In practice, I would end up installing everything by hand, even when it had installation scripts.
Sure, but isn't that the fun of being able to do just that on Amiga? ;D
Not in cases where you are trying to test the software, including its installation script.

Best regards,

Niels
Title: Re: drawer named from date
Post by: Orphan264 on February 03, 2020, 03:19:19 PM
Or, use this one.
It is a quick&dirty example.

For sorting purposes you might want to use option 'a', which fits best.

I want to thank you for going through the trouble of providing the example script! I really appreciate it!
Title: Re: drawer named from date
Post by: TribbleSmasher on February 03, 2020, 05:37:25 PM
My pleasure. I had to test it myself, aint i? :D