week

  • 25 Jun

    Q&A 18: Is there a way to change the destination based on day of week

    Q: Is there a way to change the destination based on day of week? I have a rule that moves a backup to destination daily. Would like to use same rule to move Mondays backup to a Weekly backup folder.

    A: Yes this is possible using the Destination ‘Create Subdirectory’ option. Please check the File & Directory tab.

    First Example:

    LimagitoX File Mover Day of Week example 1

    Second Example

    LimagitoX File Mover Day of Week example 2

    You can use combinations of parameters or combinations of fixed text and parameters.

     

    If you need any help , please let us know.

    Best Regards,

    Limagito Team

     

     

    By Limagito Q&A
  • 28 Apr

    Q&A 2: Is it possible to rename a file that has a date in the filename to also include the day of the week?

    Q: Is it possible in LimagitoX File Mover to rename a file that has a date in the filename to also include the day of the week?
    Here is an example of what I would like to rename.
    Original Filename: XYZ001D_04_21_20_ABCD.pdf
    (04_21_20 = April 21, 2020)
    Rename To:  Tues_XYZ001D_04_21_20_ABCD.pdf

    A: Yes this is possible using Pascal Script. Some screenshots to get you started.
    Add The Following ‘On Destination’ Pascal Script:

    // Original Filename: XYZ001D_04_21_20_ABCD.pdf
    // (04_21_20 = April 21, 2020)
    // Rename To:  Tues_XYZ001D_04_21_20_ABCD.pdf
    Var
      tmpDate: TDateTime;
      tmpDateStr: String;
      tmpPos: Integer;
      tmpLen: Integer;
      tmpDay: Integer;
    Const
      ctDateLen = 8;  
    Begin
      psExitCode := 0;
      // ... add your code here
      tmpPos := pos('_', psFileName);
      tmpLen := Length(psFileName);
      // Check
      If (tmpPos = 0) And (tmpLen = tmpPos + ctDateLen) Then
      Begin
        Try
          tmpDateStr := Copy(psFileName, tmpPos+1, ctDateLen);
          psLogWrite(1, '', 'Date stripped as String: ' + tmpDateStr);
          tmpDate := psStrToDate(tmpDateStr, 'mm_dd_yy', '_');      
          tmpDay := DayOfTheWeek(tmpDate);
          psLogWrite(1, '', 'Day Of The Week: ' + IntToStr(tmpDay));
          Case tmpDay Of
          1: psVSA := 'Mond_'; // Monday
          2: psVSA := 'Tues_'; // Tuesday
          3: psVSA := 'Wedn_'; // Wednesday
          4: psVSA := 'Thur_'; // Thursday
          5: psVSA := 'Frid_'; // Friday
          6: psVSA := 'Satu_'; // Saturday
          7: psVSA := 'Sund_'; // Sunday
          End;
          // Set ExitCode
          psExitCode := 1;
        Except
          psLogWrite(1, '', 'Exception Error when searching for Date in filename: ' + psFilePath + psFileName);     
        End;
      End
      Else
        psLogWrite(1, '', 'Not a valid filename: ' + psFilePath + psFileName);  
    End.

    In your Destination Setup select the ‘Rename’ Tab. Enable ‘Rename Files during Copy/Move and click the button next to this option.

    File Rename Setup:
    RegEx:                (.*)
    Replacement:    %VSA\1

    The goal of this renaming is to add the %VSA var in front of the filename. The %VSA var was previously set in the Pascal Script.
    The \1 corresponds with the RegEx (.*) which is in this case the complete filename.

    If you need help, please let us know. Don’t hesitate to ask.

    Regards,
    Limagito Team

    By Limagito Q&A ,
  • 02 Jul

    WeekOfTheYear ‘w’ or ‘ww’ parameter

    We are using a function called WeekOfTheYear for this parameter.

    Information:

    Call WeekOfTheYear to obtain the week of the year. WeekOfTheYear returns a value from 1 through 53.

    AYear returns the year in which the specified week occurs. Note that this may not be the same as the year of AValue. This is because the first week of a year is defined as the first week with four or more days in that year. This means that, if the first calendar day of the year is a Friday, Saturday, or Sunday, then for the first three, two, or one days of the calendar year, WeekOfTheYear returns the last week of the previous year. Similarly, if the last calendar day of the year is a Monday, Tuesday, or Wednesday, then for the last one, two, or three days of the calendar year, WeekOfTheYear returns 1 (the first week of the next calendar year).

    Note: WeekOfTheYear uses the ISO 8601 standard definition of a week. That is, a week is considered to start on a Monday and end on a Sunday.

    By Limagito Parameters ,