Dear All,

I have learned to use the shutil.move to move files from one folder to another but I need to also do the following . Would appreicate any help. Perhaps a template so I can fill the gaps and learn along the way. I have a folder with sub folders and files within those folders. The files in those folders are named like S-1237-0004-01 , S-1458-001-001.
I need to move all the files to a new folder at the root level. No need to create the sub folder structure etc. and
also when moving the files only carry the first 11 digits of the name.

Thanks

Start by walking the source folder with os.walk()

for d, dirs, files in os.walk(sourcedir):
    print(d, dirs, files)
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.