os.walk Questions
4
Solved
I'm trying to use a python script to edit a large directory of .html files in a loop. I'm having trouble looping through the filenames using os.walk(). This chunk of code just turns the html files ...
2
Solved
I'm attempting to write a Python function that will recursively delete all empty directories. This means that if directory "a" contains only "b", "b" should be deleted, then "a" should be deleted (...
2
Solved
I have a path to a certain directory, and I need to get a list of all of it's sub-directories that themselves don't contain any sub-directories.
For example, if I've got the following tree:
-fath...
2
I have huge set of files that I want to traverse through using python. I am using os.walk(source) for the same and is working but since I have a huge set of files it is taking too much and memory r...
3
Solved
I just wrote a python script to get rid of some annoying suffixes in filenames,
here's my code:
import os
for root, dirs, files in os.walk("path"):
for filename in files:
if filename.endswit...
3
Solved
I'm trying to perform some geoprocessing. My task is to locate all shapefiles within a directory, and then find the full path name for that shapefile within the directory. I can get the name ...
4
Solved
Alright, I'm working with a Bioloid Premium humanoid robot, and Mac OS X will not recognize it. So I wrote a Python script to detect changes in my /dev/ folder because any connection on a Linux-bas...
1
Solved
I have such file structure:
d:\temp\random1\index.html
d:\temp\random2\index.html
d:\temp\random3\index.html
and I want to get paths to list in python. So the output would be:
files = ['path':...
2
Solved
I am writing and testing code on XPsp3 w/ python 2.7. I am running the code on 2003 server w/ python 2.7. My dir structure will look something like this
d:\ssptemp
d:\ssptemp\ssp9-1
d:\ssptemp\ssp...
3
Solved
I'd like to recursively walk a directory, but I want python to break from any single listdir if it encounters a directory with greater than 100 files. Basically, I'm searching for a (.TXT) file, bu...
4
Solved
Perl has a lovely little utility called find2perl that will translate (quite faithfully) a command line for the Unix find utility into a Perl script to do the same.
If you have a find command lik...
4
Solved
Possible Duplicate:
How to join two generators in Python?
Is there a way in python to use os.walk to traverse multiple directories at once?
my_paths = []
path1 = '/path/to/directory/...
2
I'd like to get a list of files that apply to a regex that i have. I guess i should use os.walk, but how can i use it with regex?
Thanks.
2
Solved
I want to quickly bzip2 compress several hundred gigabytes of data
using my 8 core , 16 GB ram workstation.
Currently I am using a simple python script to compress a whole
directory tree using bzip...
1
I have a script to report me about all files, in a directory, so that users will be required to erase them (it's a really badly managed cluster, w/o real superuser).
When I run the script I get:
OS...
10
Solved
I have a piece of code which I'm using to search for the executables of game files and returning the directories. I would really like to get some sort of progress indicator as to how far along os.w...
3
Solved
So I am trying to use os.walk() to generate an XML representation of a directory structure. I seem to be getting a ton of duplicates. It properly places directories within each other and files in t...
Barhorst asked 20/1, 2010 at 21:10
© 2022 - 2024 — McMap. All rights reserved.