Change Date Modified of Series Folder

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
brijazz
Posts: 25
Joined: 25 May 2022, 20:53

Change Date Modified of Series Folder

Post by brijazz »

I use the CLI to rename my files and place them into Season folders under the Series folder, which I assume is pretty standard usage. However, the 'date modified' only changes on the Season folder when new files are added (as per the screenshot).

Is there anything I can add to my script (using -exec perhaps?) that will allow me to 'touch' the Series folder when it runs, thereby updating its 'date modifed' as well?

Image
User avatar
rednoah
The Source
Posts: 22994
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Change Date Modified of Series Folder

Post by rednoah »

I don't know how macOS updates folder Last-Modified times in response to file changes within that folder.


If touch works on folders, then you can certainly use -exec to touch the folder:

Code: Select all

-exec touch {folder}


EDIT:

FileBot r9325 enhanced --apply touch to also update the Last-Modified date for parent folders of destination files.
:idea: Please read the FAQ and How to Request Help.
brijazz
Posts: 25
Joined: 25 May 2022, 20:53

Re: Change Date Modified of Series Folder

Post by brijazz »

Thanks, I didn't know about --apply. Unfortunately, it's not working for me and the Series folder's date modified remains unchanged. Not a huge issue, just would be handy for sorting the folders in Finder. It would have been great to have this all done via Filebot, but I've found a solution using AppleScript that gets the job done. Good enough for me!
User avatar
rednoah
The Source
Posts: 22994
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Change Date Modified of Series Folder

Post by rednoah »

rednoah wrote: 26 Oct 2022, 03:37 FileBot r9325 enhanced --apply touch to also update the Last-Modified date for parent folders of destination files.
FileBot r9325 is the latest development revision from yesterday. Future releases (i.e. FileBot 4.9.8 and higher) will update the Last-Modified of parent folders as well. The current release (i.e. FileBot 4.9.6) does not implement the newly introduced behaviour.


brijazz wrote: 26 Oct 2022, 12:15 just would be handy for sorting the folders in Finder. It would have been great to have this all done via Filebot
Yes, the -exec option can be used to do that with FileBot.

↓↓↓ USE THIS ↓↓↓

Code: Select all

-exec touch {folder}
↑↑↑ USE THIS ↑↑↑
:idea: Please read the FAQ and How to Request Help.
brijazz
Posts: 25
Joined: 25 May 2022, 20:53

Re: Change Date Modified of Series Folder

Post by brijazz »

Thanks for following up, I'll await 4.9.8 to try out --apply touch. Even with -exec, I'm still not seeing 'date modified' being updated on the series folder. My command looks like this:

Code: Select all

filebot -rename myfile.mkv -non-strict --log info --log-file ~/Documents/filebot.log --format "{~plex} [{vf}]" -exec touch {folder}
Am I structuring the command incorrectly, or otherwise missing something? Any further help is much appreciated!
User avatar
rednoah
The Source
Posts: 22994
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Change Date Modified of Series Folder

Post by rednoah »

What does the console output say? (TIP: remove --log INFO so that you can see the -exec logging so you can see what touch commands are being executed)



EDIT:

-exec touch {folder} will only issue one touch command for each parent folder of each file processed. If you use series folder / season folder / episode file naming then it will touch the parent folder / season folder, but it won't touch the parent parent folder / series folder.

:idea: If you want to run touch on the parent folder and the parent parent folder, then you can add that to the -exec command template:

Code: Select all

-exec touch {folder} {folder.dir}
:idea: Please read the FAQ and How to Request Help.
brijazz
Posts: 25
Joined: 25 May 2022, 20:53

Re: Change Date Modified of Series Folder

Post by brijazz »

Success, thanks!
Post Reply