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
OrgChart JS 4.9.7
iScripts CyberMatch 1.3.3
AnyGantt JS Gantt Charts 8.7.0
Database Workbench Pro 5.6.8
Devart SSIS Data Flow Components 1.10.1
SentiMask SDK Trial 2.0.193121
dbForge Studio for SQL Server 5.8
ODBC Driver for ASE 2.1.2
The C# OCR Library 4.4.0
ODBC Driver for xBase 2.1
Rapid PHP 2018 15.5
IBDAC 6.4
Online Course Booking Script 1.3.3
Job Portal Script 1.3.2
The C# PDF Library 5.2
Top Code
iScripts CyberMatch 1.3
Database Workbench Pro 5.6.8
dbForge Studio for SQL Server 5.5
Online Course Booking Script 3.04
Availability Booking Calendar PHP 1.0
ATN Site Builder 3.0
ATN Resume Finder 2.0
PHP Review Script 1.0
Devart SSIS Data Flow Components 1.0
IBDAC 6.4
ICPennyBid Penny Auction Script 4.0
The C# PDF Library 1.0
Invoice Manager by PHPJabbers 3.0
MATLAB Support Package for Arduino (aka ArduinoIO Package) 1.0
Azizi search engine script PHP 4.1.10
Top Rated
VisualNEO Web 2018.12.15
Azizi search engine script PHP 4.1.10
Paste phpSoftPro 1.4.1
Extreme Injector 3.7
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
Invoice Manager by PHPJabbers 3.0
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
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: 3
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: 3



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