java.nio.file.FileSystemException

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
User avatar
alexander_q
Posts: 21
Joined: 19 Aug 2014, 02:02

java.nio.file.FileSystemException

Post by alexander_q »

Sysinfo (Windows Store):

Code: Select all

FileBot 4.7.12 (r5171)
JNA Native: 5.1.0
MediaInfo: 0.7.93
7-Zip-JBinding: 9.20
Chromaprint: 1.4.2
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2017-05-15 (r500)
Groovy: 2.4.10
JRE: Java(TM) SE Runtime Environment 1.8.0_141
JVM: 64-bit Java HotSpot(TM) 64-Bit Server VM
CPU/MEM: 4 Core / 3 GB Max Memory / 39 MB Used Memory
OS: Windows 10 (amd64)
Package: APPX
Done ?(?????)?
Using qBittorrent v3.3.15 x64 to run script upon download completion:

Code: Select all

"D:\utorrent-postprocess.pyw" "%L" "" "%N" "multi" "" "%F"

Code: Select all

# Run Program: 
# "C:\path\to\utorrent-postprocess.pyw" "%L" "%S" "%N" "%K" "%F" "%D"
#
# Test with Console:
# python "C:\path\to\utorrent-postprocess.pyw" "Movie" "5" "Avatar" "multi" "" "X:\Files\Avatar"


import sys
import subprocess


# configuration
output = 'D:/'


# custom formats (use / instead of \ as directory separator)
movieFormat  = "D:/_Movies/{n} ({y})/{fn}"
seriesFormat = "D:/_TV Shows/{n}/{'Season '+s}/{fn}"
animeFormat  = '''{plex}'''
musicFormat  = '''{plex}'''


# required args
label, state, title, kind, file, directory = sys.argv[1:7]


command = [
	'filebot', '-script', 'fn:amc',
	'--output', output,
	'--action', 'move',
	'--conflict', 'override',
	'-non-strict',
	'--log-file', output + 'amc.log',
	'--def',
		'unsorted=y',
		'music=n',
		'artwork=n',
		'movieFormat='  + movieFormat,
		'seriesFormat=' + seriesFormat,
		'animeFormat='  + animeFormat,
		'musicFormat='  + musicFormat,
		'ut_label=' + label,
		'ut_state=' + state,
		'ut_title=' + title,
		'ut_kind='  + kind,
		'ut_file='  + file,
		'ut_dir='   + directory
]


# execute command only for certain conditions (disabled by default)
'''
if state not in ['5', '11']:
	print('Illegal state: %s' % state)
	sys.exit(0)
'''


# execute command (and hide cmd window)
subprocess.run(command, creationflags=0x08000000)

I regularly get failures that look like this:

Code: Select all

[MOVE] Failure: java.nio.file.FileSystemException: D:\_qBittorrent\The.Last.Ship.S04E03.720p.HDTV.X264-DIMENSION[rarbg]\The.Last.Ship.S04E03.720p.HDTV.X264-DIMENSION.mkv -> D:\_TV Shows\The Last Ship\Season 4\The.Last.Ship.S04E03.720p.HDTV.X264-DIMENSION.mkv: The process cannot access the file because it is being used by another process.
Any way to avoid them?
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: java.nio.file.FileSystemException

Post by rednoah »

You can't use --action move because Windows won't allow one process to move or delete files that are used by another process.

Assuming that input/output folder is on the same filesystem, I'd recommend using --action hardlink to create an instant copy.
:idea: Please read the FAQ and How to Request Help.
User avatar
alexander_q
Posts: 21
Joined: 19 Aug 2014, 02:02

Re: java.nio.file.FileSystemException

Post by alexander_q »

Is there any way to hardlink then delete from the source afterwards?
User avatar
rednoah
The Source
Posts: 22976
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: java.nio.file.FileSystemException

Post by rednoah »

alexander_q wrote: 02 Sep 2017, 05:18 Is there any way to hardlink then delete from the source afterwards?
That operation is called --action move. :lol:

:idea: You can't delete the source file because Windows won't let you. You could have your own script go through the FileBot history and try to delete files later on, and call that script after quitting utorrent to make sure all the files are released.
:idea: Please read the FAQ and How to Request Help.
Post Reply