Solved

query file size date modified

Posted on 2009-05-10
2
535 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
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
where can I purchase audio and video RCA cables with an extended 25 ft. length? 10 57
Problem to router 7 71
Problem to Alipay 10 41
intel CPUs suffix question.. 4 37
Finding a job can be stressful - searches, resume tweaks, and networking events can be super boring. Luckily we're here to help you land your dream job!
EE introduced a new rating method known as Level, which displays in your avatar as LVL. The new Level is a numeric ranking that is based on your Points. This article discusses the rationale behind the new method and provides the mathematical formula…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The Bounty Board allows you to request an article or video on any technical topic, or fulfill a bounty request to earn points. Watch this video to learn how to use the Bounty Board to get the content you want, earn points, and browse submitted bount…

791 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