AMC script not waiting for files to finish copying

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Diehard
Posts: 9
Joined: 19 Jan 2017, 01:06

AMC script not waiting for files to finish copying

Post by Diehard »

I have the amc script called on a remote PC when a new video file has been detected in a folder.
The transfer is over a local network to a shared folder so it takes anywhere from 1-10 minutes depending on the file size.

Is there anyway for the amc script to check or wait for the file to completely finish.

Windows 10 x64
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC script not waiting for files to finish copying

Post by rednoah »

No. The FileBot must not be called on files that are being written. If you do, then behaviour is entirely unspecified and platform-dependent.

I would think that Windows would stop FileBot from moving any files with a "This file is used by another process" error.
:idea: Please read the FAQ and How to Request Help.
Diehard
Posts: 9
Joined: 19 Jan 2017, 01:06

Re: AMC script not waiting for files to finish copying

Post by Diehard »

I know for linux you can check if a file is in use and then wait for it to finish. Windows just doesn't want to/care, what windows should do is write network transfers to a temp file then rename once finished. I didn't think so but doesn't hurt to ask thanks again @rednoah
User avatar
rednoah
The Source
Posts: 22991
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC script not waiting for files to finish copying

Post by rednoah »

I don't think you can do that on any OS, unless all processes involved explicitly use read-write locks.

You can easily select only files that haven't changed for x minutes using the find command and then pass those files onto FileBot if you're on Linux. Not sure if PowerShell has any equivalent for find -exec or xargs though.
:idea: Please read the FAQ and How to Request Help.
Diehard
Posts: 9
Joined: 19 Jan 2017, 01:06

Re: AMC script not waiting for files to finish copying

Post by Diehard »

I have not found anything useful to achieve this but rather a work around.. I am using a timeout command at the beginning of my .bat script which delays for a few minutes then runs Filebot and moves to desired locations. This will not work for every size of file but it's the best solution I have found that is painless.
Post Reply