Latest recipes tagged "relative_path"http://code.activestate.com/recipes/tags/relative_path/new/2009-11-06T16:16:42-08:00ActiveState Code RecipesModified os.walk which return current directory depth (Python) 2009-11-06T16:16:42-08:00Denis Barmenkovhttp://code.activestate.com/recipes/users/57155/http://code.activestate.com/recipes/576933-modified-oswalk-which-return-current-directory-dep/ <p style="color: grey"> Python recipe 576933 by <a href="/recipes/users/57155/">Denis Barmenkov</a> (<a href="/recipes/tags/directory_depth/">directory_depth</a>, <a href="/recipes/tags/os_walk/">os_walk</a>, <a href="/recipes/tags/relative_path/">relative_path</a>). Revision 2. </p> <p>On some task I need to collect file names under specified directory with distance from it. Standard os.walk function do not return depth value.</p> <p>One solution -- find function which will calculate relative distance from top directory to file.</p> <p>Another [presented] solution -- modify os.walk so it returns depth level as fourth tuple's value.</p>