I am new to python. Infact started yesterday and feeling out of place.
I need to write a program which would transfer files under one folder
structure (there are sub folders) to a single folder. I was going through COPYTREE in shutil. But some how I am not able to put into single folder. I am sure its matter of few commands. It
would be even more great if I could get some sample code with instructions

Thanks
Lalit

What have you tried so far?

os.path.walk has a callback function. Note this is untested code. Now that you know what to look for it should be fairly easy to find examples.

import os
def processDirectory ( args, dirname, filenames ):
   print 'Directory',dirname
   for filename in filenames:
      print '     File',filename 
#                                      
top_level_dir = "/usr/local"
os.path.walk(top_level_dir, processDirectory, None )

That's a steep learning curve! One day of Python, and *POOF*, file structures.

Jeff

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.