473,320 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ListDir/ListFiles of a dir recursively

Is there a fast way to read files/directory recursively?

Instead of inspecting each file(s)/dir(s), is there a way to know that its a
file or a directory from its hidden attribut both for windows or unix
filesystem? Thanks
Jul 17 '05 #1
4 3117
On Mon, 15 Mar 2004 16:57:00 -0500, "Ruby Tuesday" <ru*********@yahoo.com>
wrote:
Is there a fast way to read files/directory recursively?
I just posted one, see the recent 'findfile' thread.
Instead of inspecting each file(s)/dir(s), is there a way to know that its a
file or a directory from its hidden attribut both for windows or unix
filesystem? Thanks


What do you mean? What's a 'hidden attribute'? How can you check attributes of
a file or directory _without_ inspecting it?

To check if something is a directory, use is_dir().

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>
Jul 17 '05 #2
Hi Andy, thanks for the script you send under "findfile" thead, and it work.

For a small directory(in term of number of files in it), it work great, but
then if there are many sub-directories and many files in each one of those
sub-directory, it starts to get very slow.

I know perhaps its a strech, but is there any other way to list files within
a directory and its sub-directories quicker.

If I'm not mistaken, in Unix, a directory is a file that contains a table
listing the files contained within it, giving file names to the inode
numbers in the list. An inode is a special file designed to be read by the
kernel to learn the information about each file. It specifies the
permissions on the file, ownership, date of creation and of last access and
change, and the physical location of the data blocks on the disk containing
the file

Is there similar method in Windows FileSystem by calling Windows System
Calls?

Thanks again.

"Andy Hassall" <an**@andyh.co.uk> wrote in message
news:aa********************************@4ax.com...
On Mon, 15 Mar 2004 16:57:00 -0500, "Ruby Tuesday" <ru*********@yahoo.com>
wrote:
Is there a fast way to read files/directory recursively?
I just posted one, see the recent 'findfile' thread.
Instead of inspecting each file(s)/dir(s), is there a way to know that its afile or a directory from its hidden attribut both for windows or unix
filesystem? Thanks


What do you mean? What's a 'hidden attribute'? How can you check

attributes of a file or directory _without_ inspecting it?

To check if something is a directory, use is_dir().

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>

Jul 17 '05 #3
Tim Van Wassenhove wrote:
On 2004-03-16, Ruby Tuesdays <No**********************@yahoo.com> wrote:
For a small directory(in term of number of files in it), it work great, but
then if there are many sub-directories and many files in each one of those
sub-directory, it starts to get very slow.

I know perhaps its a strech, but is there any other way to list files within
a directory and its sub-directories quicker.

You could consider setting up some cache...


or write it in C as a PHP module.

Jul 17 '05 #4
On 2004-03-16, Ruby Tuesdays <No**********************@yahoo.com> wrote:
For a small directory(in term of number of files in it), it work great, but
then if there are many sub-directories and many files in each one of those
sub-directory, it starts to get very slow.

I know perhaps its a strech, but is there any other way to list files within
a directory and its sub-directories quicker.


You could consider setting up some cache...
--
http://home.mysth.be/~timvw
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Jason Kratz | last post by:
OK. I've search on google groups and around the web for this and I haven't found an answer. I'm a Python newbie and have what I assume is a basic question. os.listdir takes a pathname as an arg...
8
by: Hannu Kankaanp?? | last post by:
This may be a bug or simply a strange result of undefined behaviour, but this is what I get with Python 2.3.2 on Windows XP: >>> import os >>> os.listdir('') >>> os.listdir(u'')
0
by: Ishwor | last post by:
hi check your seperator variable in the os module. :) for example >>> import os >>> os.sep '\\' Now what you do is :- >> os.listdir("D:" + os.sep + "any_other_folder_name" + os.sep); :)
7
by: Kenneth Pronovici | last post by:
I have some confusion regarding the relationship between locale, os.listdir() and unicode pathnames. I'm running Python 2.3.5 on a Debian system. If it matters, all of the files I'm dealing with...
15
by: Riccardo Galli | last post by:
Hi, I noticed that when I use os.listdir I need to work with absolute paths 90% of times. While I can use a for cycle, I'd prefere to use a list comprehension, but it becomes too long. I...
1
by: kai | last post by:
Hello, I use dircache.listdir(myDir) in my module repeatedly. On OS WIN 2000 listdir() will re-read the directory structure! But on AIX, listdir() will not re-read the directory structure (see...
3
by: vedrandekovic | last post by:
Hello Here is my simple listdir example: Here is my error: WindowsError: The system cannot find the path specified: 'l/ *.*'
3
by: eeriehunk | last post by:
Hi, According to J2SE API documentation, The description of the methods list() and listFiles() is as followes: String list() Returns an array of strings naming the files and directories...
1
by: Vladimir Rusinov | last post by:
Hello! Is there any easy way to list files using bash-like patterns? Something like listfiles("/var/log/*.log"), listfiles("/var/{cache,run}/*"). Also, I'll need something like...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.