Skip to content

Instantly share code, notes, and snippets.

@clubgisdotnet
Last active June 14, 2019 15:41
Show Gist options
  • Select an option

  • Save clubgisdotnet/6fe5fe04c5091bea3dbbb9fd36b7dc52 to your computer and use it in GitHub Desktop.

Select an option

Save clubgisdotnet/6fe5fe04c5091bea3dbbb9fd36b7dc52 to your computer and use it in GitHub Desktop.
Wrap each files with a folder
# !/usr/bin/python
# -*- coding: utf-8 -*-
# Wrap each files to its own folder, run once
import os
import shutil
dir_name = "D:\\DOCUMENTS\\Google_Link\\all docx"
docx_files = os.listdir(dir_name)
for i in docx_files:
os.mkdir(os.path.join(dir_name , i.split(".")[0]))
shutil.move(os.path.join(dir_name , i), os.path.join(dir_name , i.split(".")[0]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment