I looked into the Python os interface, but was unable to locate a method to move a file. How would I do the equivalent of $ mv ...
in Python?
&g
This is solution, which does not enables shell
using mv
.
import subprocess
source = 'pathToCurrent/file.foo'
destination = 'pathToNew/file.foo'
p = subprocess.Popen(['mv', source, destination], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output = p.communicate()[0].decode('utf-8').strip()
if p.returncode:
print(f"E:{output}")