Git Product home page Git Product logo

change-file-structure's Introduction

change-file-structure

Naive script to restructure a directory tree by converting parent-child relationships.

Run it like so (Python 3.6):

$ python src/change_file_structure <SOURCE_DIR> <DEST_DIR>

What is does:

Suppose you have a directory tree with foo, bar, and baz as parent directories of spam and ham, such as the following pattern:

SOURCE__
		|_foo__spam__leaf1
		|    |     |_leaf2
		|    |        :
		|    |
		|    |_ham___leaf3
		|          |_leaf4
		|          |_leaf5
		|             :
		|      
		|_bar__spam _leaf6
		|    |     |_leaf7
		|    |        :
		|    |
		|    |_ham___leaf8
		|          |_leaf9
		|          |_leaf10
		|             :
		|       
		|_baz__spam__leaf11
		|    |     |_leaf12
		|    |        :
		|    |
		|    |_ham___leaf13
		|          |_leaf14
		|          |_leaf15
		|             :
		:

change-file-structure would convert it such that spam and ham are now the parent directories of foo, bar, and baz. The above example would be converted into the following tree structure:

DEST__spam__foo__leaf1
	  |  |     |_leaf2
	  |  |         :
	  |  |
	  |  |__bar__leaf6
	  |  |     |_leaf7
	  |  |         :
	  |  |
	  |  |__baz__leaf11
	  |        |_leaf12
	  |           :
	  |
	  ham___foo__leaf3
	  |  |     |_leaf4
	  |  |     |_leaf5
	  |  |         :
	  |  |
	  |  |__bar__leaf8
	  |  |     |_leaf9
	  |  |     |_leaf10
	  |  |         :
	  |  |
	  |  |__baz__leaf13
	  |        |_leaf14
	  |        |_leaf15
	  |           :
	  :

Only copies, but does not delete, the original structure to the destination directory.

change-file-structure's People

Contributors

mjkrause avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.