Author Topic: REXX help - check to see if file is present.  (Read 4603 times)

Doug Bissett

  • Hero Member
  • *****
  • Thank You
  • -Given: 1
  • -Receive: 38
  • Posts: 925
    • View Profile
Re: REXX help - check to see if file is present.
« Reply #15 on: November 23, 2016, 06:35:17 pm »
Quote
I want to use the file name Ziipboot_Current.zip and, then change it to Zipboot_20161123.zip on the next backup run.

Why not just add the current date when it is created? That would make it easier to sort, and there is less chance that an old file might be lurking somewhere, just waiting to be found, and used.

You should also remember that different locales use different date formats, and you should handle the case where two (or more) backups are done on the same date, so it may be good to include the time too (again, locale makes a difference, although using the 24 hour clock might be best).

Greggory Shaw

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 36
  • -Receive: 19
  • Posts: 415
    • View Profile
Re: REXX help - check to see if file is present.
« Reply #16 on: November 27, 2016, 01:43:02 pm »

You should also remember that different locales use different date formats, and you should handle the case where two (or more) backups are done on the same date, so it may be good to include the time too (again, locale makes a difference, although using the 24 hour clock might be best).

Good point on the locales. Problem is that I need Zipboot_Current.zip as a filename too (my lack of programming skills).

I fixed it by using by adding the date to the files and making a copy with the 'Zipboot_Current.zip' name. Guess I should add the 24 hour clock for hourly backups instead of just daily ones.


Thx
« Last Edit: November 27, 2016, 01:45:21 pm by Greggory Shaw »

Jan-Erik Lärka

  • Global Moderator
  • Full Member
  • *****
  • Thank You
  • -Given: 5
  • -Receive: 11
  • Posts: 151
    • View Profile
Re: REXX help - check to see if file is present.
« Reply #17 on: December 06, 2016, 03:30:31 pm »
Perhaps something like:
filedate = SPACE( TRANSLATE( STREAM( fileName, "C", "QUERY DATETIME" ),, SPACE( TRANSLATE( XRANGE(),, XRANGE( 0, 9 ) ), 0 ) ), 0 )

//Jan-Erik Lärka

Greggory Shaw

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 36
  • -Receive: 19
  • Posts: 415
    • View Profile
Re: REXX help - check to see if file is present.
« Reply #18 on: December 11, 2016, 10:15:22 pm »
Perhaps something like:
filedate = SPACE( TRANSLATE( STREAM( fileName, "C", "QUERY DATETIME" ),, SPACE( TRANSLATE( XRANGE(),, XRANGE( 0, 9 ) ), 0 ) ), 0 )

//Jan-Erik Lärka

Hi Jan,

Thank you so much for all the help and everyone else that has commented and helped out !!!


Greggory