Solved

query file size date modified

Posted on 2009-05-10
2
545 Views
Last Modified: 2012-05-06
Hi,

               Is it possible to get the file owner, comments, author and title of a file in windows explorer in python.

Brgds,

kNish
0
Comment
Question by:eyeqube
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 29

Accepted Solution

by:
pepr earned 250 total points
ID: 24352435
Python functionality tries to be "portable". It may mean that similar things for various OSes may be solved specifically for each OS and presented via some common interface. However, some things may be too OS specific. I guess that you have to use the win32api extension for Python (download it via http://python.net/crew/mhammond/win32/) and solve the problem using the Windows API -- see http://timgolden.me.uk/python-on-windows/programming-areas/security/ownership.html for the example.

For the "in windows explorer" part of the question, it is the same as in your previous question. You just write a script that accepts the filename as the first argument. Then you drag the wanted file icon over the script icon. It technically does the same as:

C:\tmp> python myscript.py filename

0
 
LVL 29

Expert Comment

by:pepr
ID: 24352941
For the other, general attributes of a file, see:
os.path.getsize() http://docs.python.org/library/os.path.html#os.path.getsize
os.paht.getmtime() http://docs.python.org/library/os.path.html#os.path.getmtime
and the company.

For getting more than one attribute for a file, you can also use the os.stat() function http://docs.python.org/library/os.html#os.stat

and the constants defined in the stat module http://docs.python.org/library/stat.html

0

Featured Post

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally published Entrepreneur.com Booming numbers of freelancing professionals are changing the face of work. In the United States alone last year, the number of workers freelancing grew from 700,000 to 54 million, according to a Freelancers’…
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question