Answers for "python move files from one directory to another"

5

python how move file to directory

import shutil, os
files = ['file1.txt', 'file2.txt', 'file3.txt']
for f in files:
    shutil.move(f, 'dest_folder')
Posted by: Guest on April-13-2021
7

python move file

import os, shutil
#move picture.png from /some/dir/ to /another/dir/Pictures/
shutil.move('/some/dir/picture.png', '/another/dir/Pictures/')
Posted by: Guest on July-06-2020
3

move file python

import os
import shutil

os.rename("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
shutil.move("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
os.replace("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
Posted by: Guest on November-04-2020
0

os.move file

import os
import shutil

os.rename("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
shutil.move("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
os.replace("path/to/current/file.foo", "path/to/new/destination/for/file.foo")
Posted by: Guest on August-24-2020

Code answers related to "python move files from one directory to another"

Python Answers by Framework

Browse Popular Code Answers by Language