Search
Code Directory
 ASP
 ASP.NET
 C/C++
 CFML
 CGI/PERL
 Delphi
 Development
 Flash
 HTML
 Java
 JavaScript
 Pascal
 PHP
 Python
 SQL
 Tools
 Visual Basic & VB.NET
 XML
New Code
.Net VCL for Delphi 1.0.0.0
ASP. NET C# PDF Software 4.5
LinqConnect Professional 4.8
CAD VCL: 2D/3D CAD in Delphi/C++Builder 14
wolfSSL 3.15.7
CAD DLL 14
AnyStock Stock and Financial JS Charts 8.4.2
ODBC Driver for SQLite 2.4
dotConnect for SugarCRM 1.7
dbForge SQL Complete 5.9
dbForge Studio for MySQL 8.0
.Net Runtime Library for Delphi 6.0.4.0
Scimbo 1.64
AnyMap JS Maps 8.4.2
GetOrgChart 2.5.3
Top Code
Issue Manager App 1.0
i-Net School Management Script 1.0.4
Online Vacation Rental Booking Website Script 4.3.0
Hotel Management - Full Board Version 6.55
Simple Hill-Climbing 1.0
Ticket Booking System 1.0
College Management System Script 1.0.4
Skincare Management System 1.4
Library Management System 1.0
Faculty Evaluation System 1.1
.Net VCL for Delphi 1.0.0.0
ASP. NET C# PDF Software 4.5
MATLAB Support Package for Arduino (aka ArduinoIO Package) 1.0
MCU 8051 IDE 1.4.7
CPP-2-HTML CSS Source Code Tagger 1.02
Top Rated
Paste phpSoftPro 1.4.1
Deals and Discounts Website Script 1.0.2
ADO.NET Provider for ExactTarget 1.0
Solid File System OS edition 5.1
Classified Ad Lister 1.0
Aglowsoft SQL Query Tools 8.2
ICPennyBid Penny Auction Script 4.0
PHP Review Script 1.0
ATN Resume Finder 2.0
ATN Site Builder 3.0
Availability Booking Calendar PHP 1.0
PHP GZ Blog Script 1.1
ATN Jobs Software 4.0
ATN Mall 2.0
WeBuilder 2015 13.3
Modified os.walk which return current directory depth 
File ID: 64988






Modified os.walk which return current directory depth 
Download Modified os.walk which return current directory depth http://code.activestate.com/recipes/577214-fix-mbox-files-after-importing-eml-into-tb-using-i/?in=lang-pythonReport Error Link
License: Freeware
Downloads: 2
Submit Rating:
Modified os.walk which return current directory depth  Description
Description: 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.

One solution -- find function which will calculate relative distance from top directory to file.

Another [presented] solution -- modify os.walk so it returns depth level as fourth tuple's value.

License: Freeware

Related: directory depth, os walk, relative path

O/S:Windows

Downloads: 2



More Similar Code

The standard lib os.walk() function provides a topdown parameter that determines whether entries are yielded in a top-down or a bottom-up order. Sometimes though you may want each directory yielded twice; once before any of its children directories (and recursively their descendants) are yielded and once after they are all yielded. The walk2() function below does this by yielding 4-tuples; the first 3 elements are the same yielded by os.walk()...



Add all dirs under folder to sys.path if any .py files are found.
Use an abspath if you'd rather do it that way.

Uses the current working directory as the location of using.py.
Keep in mind that os.walk goes all the way down...



Walker encapsulates os.walk's directory traversal as an object with the added features of excluded directories and a hook for calling an outside function to act on each file.

Walker can easily be subclassed for more functionality, as...



GOTO filename changes MATLAB current directory to the one containing filename. filename must be on the MATLAB path. goto uses the first instance of filename that it finds (a la WHICH).

This is not rocket science, but it sure is convenient!



COMMAND WINDOW, CURRENT DIRECTORY, WORKSPACE, COMMAND HISTORY.



INTENT creates a plot of relationships between mfiles in the current directory, as inferred by the names of input and output arguments.



You run this script with directory as parameter (defaults to current directory) and scripts watch this directory for changes in files - creating new file, deleting some file and modification to any file. All these changes are periodically commited...



A python class which "watches" a directory and calls a callback(filename, lines) function every time one of the files being watched gets written, in real time.

Practically speaking, this can be compared to "tail -f...



Packs all python source files from current directory into a single recipe file that can be later run to recreate packed files. Skips files whose names begin with underscore or contain "recipe".



Remove ID3 tags from all files in the current directory

User Review for Modified os.walk which return current directory depth
- required fields
     

Please enter text on the image