#1 2020-10-01 16:58

Saxparilla
Member
Registered: 2020-10-01
Posts: 3

How to Set M-F Dates as Folder Names

Hi from new Renamer User!

Let's say I have 20 folders and I want to name them based on Monday through Friday dates. For example

09-28-20
09-29-20
09-30-20
10-01-20
10-02-20 (skip Sat and Sun dates)
10-05-20
10-06-20
10-07-20
10-08-20
10-09-20
(again, skipping Sat and Sun dates, etc.)

I've been successful at replacing text strings and serializing, but can't figure out how to do this.
If you could give me step-by-step instructions, I would be ever so grateful!

Thank you!!!

Offline

#2 2020-10-01 19:13

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,367

Re: How to Set M-F Dates as Folder Names

Welcome!

You can do this with the Pascal Script rule.

Here is a good start:

const
  StartDate = '2020-10-01';
var
  Date: TDateTime;
begin
  if Date = 0 then
    Date := ScanDateTime('yyyy-mm-dd', StartDate);
  FileName := FormatDateTime('yyyy-mm-dd', Date);
  repeat
    Date := IncDay(Date, 1);
  until DayOfWeek(Date) <= 5;
end.

It will produce the following names:

2020-10-01
2020-10-02
2020-10-05
2020-10-06
2020-10-07
2020-10-08
2020-10-09
2020-10-12
2020-10-13
2020-10-14
...

Function reference:
https://www.den4b.com/wiki/ReNamer:Pasc … :Functions

Offline

#3 2020-10-02 16:48

Saxparilla
Member
Registered: 2020-10-01
Posts: 3

Re: How to Set M-F Dates as Folder Names

Dear Admin,

Thanks for your post. Unfortunately, your reply was too complicated for me. I pasted your code into the Pascal functions, but it just turned up errors.

I did accomplish what I needed using an extremely simple method:

1) created 31 "new folders"

2) serialized 01 thru 31 (renaming)

3) rule adding prefix 01-

4) plus, rule adding suffix -21

Results in 31 folders for 01-01-21 thru 01-31-21 (January, 2021)

Copy those elsewhere, then rename first 2 digits to 02-

Results in 31 folders for February. (Move first 28 folders elsewhere)

Continue renaming for March through December.

Then, I can delete the Sat and Sun folders, and have my 2021 Mon-Fri folders (while keeping all 365 to rename for 2022, etc.)

Now, I have my full year's date folders and can personalize those with additional string info as needed.

Took me about 10-15 mins and I'm good to go!!!

Thank you!

Offline

#4 2020-10-02 18:10

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,367

Re: How to Set M-F Dates as Folder Names

The previously provided script was only meant to demonstrate how to date stamp files/folders using only Monday-Firday and starting from a defined date, i.e. '2020-10-01' in that case.

You can then adjust the starting date and the date format to fit your needs.

A slightly modified script here:

const
  StartDate = '2020-09-28';
var
  Date: TDateTime;
begin
  if Date = 0 then
    Date := ScanDateTime('yyyy-mm-dd', StartDate);
  FileName := FormatDateTime('mm-dd-yy', Date);
  repeat
    Date := IncDay(Date, 1);
  until DayOfWeek(Date) <= 5;
end.

Will produce what your had in the original example:

09-28-20
09-29-20
09-30-20
10-01-20
10-02-20
10-05-20
10-06-20
10-07-20
10-08-20
10-09-20
...

Offline

#5 2020-10-02 18:14

Saxparilla
Member
Registered: 2020-10-01
Posts: 3

Re: How to Set M-F Dates as Folder Names

Thank you, I will try this for the rest of this year!

Offline

Board footer

Powered by FluxBB