By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,905 Members | 1,630 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,905 IT Pros & Developers. It's quick & easy.

How To Do It Faster?!?

P: n/a
Hello max & NG,
I don't quite understand what your program is doing. The user=a[18::20]
looks really fragile/specific to a directory to me.
I corrected it to user=a[18::5][:-2], it was my mistake. However, that command
is NOT specific to a particular directory. You can try to whatever directory
or net resource mounted on your system. It works.
a=os.popen("dir /s /q /-c /a-d " + root).read().splitlines()

Mhm... have you tried this command on a BIG directory? On your C: drive
for example? I had to kill Python after having issued that command because
it ate up all my CPU (1GB) for a quite long time. There simply are too many
files/information to retrieve in a single command.
In my first mail, I said I have to work with a BIG directory (more than
1 TB) and I need to retrieve information when they become available (I put
this info on a wxPython ListCtrl). This is why I have chosen os.walk() and
that command (that runs on a separate thread wrt the ListCtrl).
It does NOT run faster than your command (probably my solution is slower),
but I can get information on every directory I scan, while with your command
I have to wait a long time to process the results, plus the user can not
interact with the results already found.
To get a list containing files owned by a specific user, do something like: files=[line.split()[-1] for line in a if owner in line]

I will try this solution also.

Thanks NG for your useful suggestions.


Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.