Pages

Wednesday, April 9, 2014

Tracking Changes in Directories with Python

Tracking Changes in Directories with Python

An excellent API in python to track changes made in a directory.

Refer this link:


@ GIT
https://github.com/tsileo/dirtools

An example code taken from that site

from dirtools import Dir, DirState 
path="/"
d = Dir(path)
dir_state = DirState(d)

state_file = dir_state.to_json()

# Later... after some changes

dir_state = DirState.from_json(state_file)
dir_state2 = DirState(d)

changes = dir_state2 - dir_state
 
 
This creates a json file in the current working directory.
 

2 comments:

  1. Dear Krishna, Am really pleased to read your blog. Unlike other blogs your blogpost gives the solution for the day to day problems of a developer in a crisp manner.

    And I really respect your way of giving credits to the original poster where you find the solution.

    Keep it up, and keep going.. In a longer run you(& one) will find that your blog will become one of most important treasure which will solve all the technical problems of yours(&one).


    இனிய பிறந்தநாள் வாழ்த்துகள்.... Happy Birthday dude..

    ReplyDelete
  2. thanks karthikeyan.
    I thank you for your compliments.
    Compliments and comments from people like you, make me to continue blogging.

    ReplyDelete