Jython 2.2.1, howto move a file? shutils.move is non-existant!

'''use Jython'''

import shutil

print dir(shutil)

There is no, shutil.move, how does one move a file with Jython? and while we at it, how does one delete a file with Jython?


Asked by: Daniel761 | Posted: 28-01-2022






Answer 1

os.rename() to move, and os.unlink() to delete -- just like Python pre-shutil.

Answered by: Brooke791 | Posted: 01-03-2022



Answer 2

If you need support for moving across filesystems, consider just copying CPython's shutil.py into your project. The Python License is flexible enough to allow this (even for commercial projects), as long as licensing and attribution information are retained.

Answered by: Rubie986 | Posted: 01-03-2022



Answer 3

f1 = File(filename_old)
f1.nameTo(File(filename_new))

Answered by: Daryl224 | Posted: 01-03-2022



Similar questions





Still can't find your answer? Check out these communities...



PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python



top