473,544 Members | 1,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3128
On Mon, 15 Mar 2004 16:57:00 -0500, "Ruby Tuesday" <ru*********@ya hoo.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.andyhsoftwa re.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.c om...
On Mon, 15 Mar 2004 16:57:00 -0500, "Ruby Tuesday" <ru*********@ya hoo.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.andyhsoftwa re.co.uk/space>

Jul 17 '05 #3
Tim Van Wassenhove wrote:
On 2004-03-16, Ruby Tuesdays <No************ **********@yaho o.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************ **********@yaho o.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
23013
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 but it doesn't actually list the contents of the dir I pass in. it always operates on the current dir (wherever the script is run) and I have to...
8
2442
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
465
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
3859
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 are on an ext3 filesystem. The real code this problem comes from takes a configured set of directories to deal with and walks through each of...
15
2565
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 propose to add an 'abs' keyword which would make os.listdir return the absolute path of files instead of a relative path. This would bring only...
1
3247
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 Python Library Reference). I work with python version 2.2. Now my 2 questions: Why does dircache.listdir() work different?
3
8742
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
1693
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 in the directory denoted by this abstract pathname. File listFiles() Returns an array of abstract pathnames denoting the files in the...
1
4448
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 listfiles("/tmp/**/*.tmp"), where ** is unlimited number of folders (like is zsh). Thanks and sorry for my English.
0
7368
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7774
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7381
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5914
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4920
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3412
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1843
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
989
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.