Return to Snippet

Revision: 66030
at March 1, 2014 06:17 by jlmarks

Initial Code
import os, shutil

def movefiles():
    inputDir=raw_input("please enter the folder where the files are: ")
    outputDir=raw_input("please enter the destination folder")
    for root, dirs, files in os.walk(inputDir topdown=False):
        for name in files:
            shutil.move(os.path.join(root, name), os.path.join(outputDir,newname))
        for name in dirs:
            os.rmdir(os.path.join(root, name))

Initial URL

Initial Description
This file starts at the bottom of the tree and recursively moves all of the files from that tree into another folder. To avoid overwriting files I prepended all of the files with a 9digit number.

Initial Title
Recursively consolodate all Files into one folder

Initial Tags
file, python

Initial Language