Week Number in File Name

Ask for help and post your question on how to use XnView MP.

Moderators: XnTriq, helmut, xnview

Post Reply
socra
Posts: 7
Joined: Wed Apr 24, 2019 1:56 am

Week Number in File Name

Post by socra »

Is there a way to add "week number" into the file name during a rename operation?
User avatar
xnview
Author of XnView
Posts: 43442
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Week Number in File Name

Post by xnview »

no sorry
Pierre.
User avatar
michel038
XnThusiast
Posts: 1285
Joined: Tue Sep 27, 2016 8:18 am
Location: France
Contact:

Re: Week Number in File Name

Post 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"
Last edited by michel038 on Mon Apr 19, 2021 6:30 pm, edited 2 times in total.
socra
Posts: 7
Joined: Wed Apr 24, 2019 1:56 am

Re: Week Number in File Name

Post 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.
User avatar
michel038
XnThusiast
Posts: 1285
Joined: Tue Sep 27, 2016 8:18 am
Location: France
Contact:

Re: Week Number in File Name

Post 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...
socra
Posts: 7
Joined: Wed Apr 24, 2019 1:56 am

Re: Week Number in File Name

Post by socra »

Why doesn't xnview have a "week number" variable, though? Is there some technical reason, or something else?
User avatar
michel038
XnThusiast
Posts: 1285
Joined: Tue Sep 27, 2016 8:18 am
Location: France
Contact:

Re: Week Number in File Name

Post 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 ...
Post Reply