DataSmash wrote: > Hi, > I need to organize thousands of directories full of files. > I want to move these directories into other subdirectories. > For example, all the directories that start with 01, move to > a directory named "one", all directories that start with 02, move > to a directory name "two", and so on.... > > I can't seem to find any easy way to do this. > Looks like shutil.move only lets you move if the subdirectory DOES > NOT exist, so after the first directory moves, the script blows up on > the second move. > I guess you could use shutil.copy or shutil.copytree but then you have > to > delete as well. Much longer process when you have hundreds of > gigabytes of data. > > Thanks for your help! > R.D. > Use win32.moveFile method instead. This links directly to the Windows MoveFile method that just moves the directory entries around.
>From Win32 Documentation: win32api.MoveFile MoveFile(srcName, destName) Renames a file, or a directory (including its children). Parameters srcName : string The name of the source file. destName : string The name of the destination file. Comments This method can not move files across volumes. -Larry -- http://mail.python.org/mailman/listinfo/python-list