Page 1 of 1

Week Number in File Name

Posted: Mon Apr 12, 2021 2:58 am
by socra
Is there a way to add "week number" into the file name during a rename operation?

Re: Week Number in File Name

Posted: Mon Apr 12, 2021 8:39 am
by xnview
no sorry

Re: Week Number in File Name

Posted: Mon Apr 12, 2021 12:01 pm
by michel038
Week number can be different in (Canada, U.S.) and (Europe ?)
Week Number ISO : week 1, is the one which contains January 4th .
(Mon Dec, 29th can be in week 1 ISO. So Mon, dec 29th 2008 is in week 1 , 2009 iso)


Maybe you can ask this question on ExifTool forum
Exiftool can rename files with a part of a date , but I don't know how to insert week number in the filename
You can use ExifTool through XnViewMP with "Tools, Open With , Configure", select AddOn\exiftool.exe , and add the right parameters ...

You can try this parameter -d %W "-FileName<CreateDate"

Maybe it's a part of the solution ?

(see https://exiftool.org/filename.html , next to the end of the page)

EDIT : use these parameters to add week number ($createdate) before filename (%f) with format ( -d %W) and keep exiftool window open(-k)

Code: Select all

-k -d %W "-FileName<$CreateDate%f"

Re: Week Number in File Name

Posted: Tue Apr 13, 2021 2:40 am
by socra
Thanks for the response, both of you! I was able to get the xnview suggestion setup to rename files using this standard: YYYY-WW-MMDD-HHMMSS.jpg!
I'm sure this is a dumb question, but I will ask anyways because asking dumb questions is just what i do sometimes.

I have been using this for file renaming, "{EXIF:Date [Ymd-HMS]}" for an output of YYYYMMDD-HHMMSS.jpg. Why can't xnview use the %W modifier in file renames, to give an output like YYYY-WW-MMDD-HHMMSS.jpg?

I am reviewing & studying the exiftools renaming flags, but wow there is a lot there. Do you know if there is a way to "insert" week number into a file name? I already have files named "YYYYMMDD-HHMMSS--<notes>.jpg". Can I make this look like "YYYY-WW-MMDD-HHMMSS--<notes>.jpg"?

Thanks.

Re: Week Number in File Name

Posted: Tue Apr 13, 2021 8:42 am
by michel038
Why can't xnview use the %W modifier in file renames
XnViewMp has it's own set of formats.
ExifTool is another world.

I think it's possible to process replacement with ExifTool (replace year by year-week) you can ask this in ExifTool forum...

Re: Week Number in File Name

Posted: Tue Apr 13, 2021 10:23 am
by socra
Why doesn't xnview have a "week number" variable, though? Is there some technical reason, or something else?

Re: Week Number in File Name

Posted: Thu Apr 15, 2021 9:21 am
by michel038
I already have files named "YYYYMMDD-HHMMSS--<notes>.jpg". Can I make this look like "YYYY-WW-MMDD-HHMMSS--<notes>.jpg"?
As I said above,
You can use ExifTool through XnViewMP with "Tools, Open With , Configure", select AddOn\exiftool.exe , and add the right correct parameters ...
You should choose a name to insert in first column for this "open with" feature, such as AddWeekNumber.

This parameter can do the job, first with TestName so you can read ExifTool report, with previous name and the new calculated name for files.

Code: Select all

-k  -d %Y-%W- -TestName<${CreateDate}${FileName;s/^[0-9]{4}//}
If the result is ok, use FileName instead of TestName

Explanation
-k : keep exiftool window open
-d : Date format ...
%Y-%W- : Year (4 digits), caret, Week, caret

-TestName : target field (replace -TestName by -FileName for effective renaming)
< : Result of following expression will enter in TestName
${ : Evaluate expression
CreateDate : source data to be filtered by -d option before entering into TestName
FileName : 2nd source data to append to TestName (${FileName : FileName will also be processed)
; (semicolon) : a process is following
s/^[0-9]{4}/ : replace four digits at the beginning of Filename ... (RegEx processing)
/ : by nothing

Usage
Select files, Right Click, Open With, AddWeekNumber ...