Need help with post processing - touch files - modified date

Any questions? Need some help?
Post Reply
begunfx
Posts: 28
Joined: 11 Jan 2025, 14:55

Need help with post processing - touch files - modified date

Post by begunfx »

I have a files on two physical servers that are sync'd together (both synology servers). When I try to rename files on one, the other isn't updating with the name changes. I suspect because the modified date of the renamed files isn't changing. I tried changing the "creation date" and timestamp using post processing but still no change. My thought was to try to change the modified date of the files in question, but it looks like there isn't a preset for that in the post-processing dialog. So I'm looking at having to create a custom script. Can someone please help with some guidance on how to accomplish this? I looked at the example scripts, but am at a bit of a loss on how to implement what I need. Thanks in advance for your help!
User avatar
rednoah
The Source
Posts: 23924
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with post processing - touch files - modified date

Post by rednoah »

:?: How does Synology sync servers? If you move / rename file, then that means one file disappears and one file appears, and so tools like rsync would delete one file and then copy the other when mirroring the folder again, since you can't really know which file used to be which other file.


:arrow: That said, you can use the Set time stamp post-processing feature if you simply want to update the time stamp to the current date/time for each processed file:

Shell: Select all

--apply touch

:idea: This is equivalent to calling touch on each processed file:

Shell: Select all

-exec touch {f} +
:idea: Please read the FAQ and How to Request Help.
begunfx
Posts: 28
Joined: 11 Jan 2025, 14:55

Re: Need help with post processing - touch files - modified date

Post by begunfx »

Thanks for the quick response. I'm using drive sync utility for Synology. I'm not sure how it handles renaming files. Additional note: I am renaming the files in-place using the following custom preset: {drive}/{plex.name} So I'm not sure if that has any impact on file changes. However, if I manually rename a file without moving it to a new location (in-place) the sync updates properly.

When I put -exec touch {f} + in the script editor I get an error: "Syntax Error: Unexpected input 'touch {f} +

When I put --apply touch I get the following: "MissingProperty: no such property: apply for class: Script"
User avatar
rednoah
The Source
Posts: 23924
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with post processing - touch files - modified date

Post by rednoah »

:?: Which OS are you using? Does "drive sync utility" refer to the Synology Drive Client or something else? You might need to ask the developer how sync handles files that are moved by 3rd party programs.


:idea: --apply and -exec are command-line options and not post-processing scripts.


:idea: {plex.name} renames files in place. {drive}/{plex.name} explicitly moves files to the root folder of the drive.


:arrow: If you're using the GUI then checking Set time stamp does what you mean to do. It'll update the last-modified time stamp to the current time stamp. If you believe otherwise, provide screenshots. You can copy the Run Command example if you want to run a custom command on each file, but you'd first need to know which command - if any - would actually make your sync utility work.

Screenshot
:idea: Please read the FAQ and How to Request Help.
begunfx
Posts: 28
Joined: 11 Jan 2025, 14:55

Re: Need help with post processing - touch files - modified date

Post by begunfx »

For Synology I'm on DSM 7.2.2. The sync utility in question is a built-in Synology utility called "Synology Drive ShareSync".

I had previously installed the 3rd party version of filebot (jlesage/filebot) and found that {drive}/{plex.name} and {plex.name} do the same thing (copy in place). To be sure it wasn't something specific to that version of filebot I went ahead and installed your version.

When I try either {drive}/{plex.name} or just {plex.name} I get a permission denied error and can't rename the files. The error shows the same location for both versions of the expression.

See screenshot:
Screenshot
begunfx
Posts: 28
Joined: 11 Jan 2025, 14:55

Re: Need help with post processing - touch files - modified date

Post by begunfx »

I checked the permissions on the folder above the files and it seems like "write" for group and other was unchecked. I checked all the permissions and was able to get the rename to work. However, even if I tick "timestamp" for post processing it looks like the modified date of the files does not update.
begunfx
Posts: 28
Joined: 11 Jan 2025, 14:55

Re: Need help with post processing - touch files - modified date

Post by begunfx »

Here is a screenshot of my source server that renamed the files. As you can see by the modified date still has an old date on them:

Screenshot
Last edited by begunfx on 11 Jan 2025, 22:18, edited 1 time in total.
begunfx
Posts: 28
Joined: 11 Jan 2025, 14:55

Re: Need help with post processing - touch files - modified date

Post by begunfx »

Incidentally I tried using {drive}/{plex.name} and {plex.name} as rename expressions and they both seem to do the same thing renaming the files in place (for your version of filebot). {drive}/{plex.name} does not seem to move the files to the root of the drive as you mentioned in your previous post.
User avatar
rednoah
The Source
Posts: 23924
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with post processing - touch files - modified date

Post by rednoah »

:idea: If {drive} and {folder} happen to be the same then - in this special case - you will be renaming files in place. On Windows, {drive} will give you the root drive. On Linux, {drive} will give you the mount point. You are using Linux.


:?: I see that you are using a local docker container with a WebUI, not a remote Windows client. Can your docker container change the last-modified date? What does the log say?


:idea: Since your docker container is a Linux machine, you can use the touch command to confirm for yourself that changing the last-modified date does / does not work. The following post-processing script will call touch on newly processed files:

Groovy: Select all

{ source, target ->
	system 'touch', target
}
:idea: Please read the FAQ and How to Request Help.
begunfx
Posts: 28
Joined: 11 Jan 2025, 14:55

Re: Need help with post processing - touch files - modified date

Post by begunfx »

Okay. Thanks for clarity on the {drive} and {folder} options. Noted. As for the modification of files, I ssh'd into my primary server and ran a touch command on the test file. It didn't look like the slave server's file timestamp updated. If I run the touch command you provided above as a post process it does update the source test files timestamp, but also doesn't not trigger a change in the destination files. There must be another way that then that Synology Drive ShareSync detects changes in the file. I would have assume doing the rename would have been enough. Any ideas?
begunfx
Posts: 28
Joined: 11 Jan 2025, 14:55

Re: Need help with post processing - touch files - modified date

Post by begunfx »

After some research, it seems like there is an issue with Docker not triggering 'inotify' events on synology which is what it's drive sync uses to update files. Somehow, I need a way to trigger an 'inotify' event or force a manual index to update the files. Any suggestions? I'm stumped. All the workarounds I found didn't look very appealing.

The only thing I could possibly think of is create a script that runs a touch on files using an argument and have that script live on my host outside of docker and then somehow have filebot call that script and pass the path/filename(s) to it. It seems like filebot is capable of triggering an external script. Any guidance on how to do this? Thanks!

Edit: To test, I renamed files on my source host via filebot, but ran a touch command via ssh directly on the host on one of the files. Sure enough, the destination host updated the name to match. The only problem I found was if I revert the source files back, if I do the same thing with touch it just thinks a new file was added. So really it would have to be some sort of triggering with a re-index is my guess but I can't seem to find anyway on a synology server to execute a re-index via command prompt the drive syncShare utility.

So in essence at the moment the workaround is to trigger a touch in an external script and not use the "revert" functionality (which would suck).
User avatar
rednoah
The Source
Posts: 23924
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with post processing - touch files - modified date

Post by rednoah »

Why use docker at all? Looks like it's not suitable for your use case.

You can just rename files via a network drive from your Desktop. If a SMB share does not work for some reason then you can always use SFTP or SSHFS since you already have that.

If you must use your docker container WebUI then you can at least still use normal Synology non-docker filebot on a schedule to auto-generate the secondary structure.
:idea: Please read the FAQ and How to Request Help.
begunfx
Posts: 28
Joined: 11 Jan 2025, 14:55

Re: Need help with post processing - touch files - modified date

Post by begunfx »

Thanks, rednoah. I hadn't thought about using the desktop version. I went ahead and downloaded the mac version and it worked as expected. I guess going with the desktop version the only thing I lose is the ability to use it remotely, but it's not the end of the world. As it is, I will most likely do the renaming locally anyway.
User avatar
rednoah
The Source
Posts: 23924
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Need help with post processing - touch files - modified date

Post by rednoah »

You may also consider setting up some automation with the CLI. We have FileBot packages for Synology. Installation is easy. Usage naturally not as easy as the Desktop app. But that way you could set up some automation and process files on device without the problematic docker overlay file system layer. Some prefer the CLI over the GUI because it's easy to use via SSH remotely.




EDIT:

An issue that you will find with the macOS SMB implementation is that hard links don't work. Oddly enough, modern Windows implements the SMB unix extensions while macOS does not. So to auto-generate your secondary structure with hard links, you will likely have to do so on device, or use a Windows Desktop.
:idea: Please read the FAQ and How to Request Help.
Post Reply