Solved

query file size date modified

Posted on 2009-05-10
2
522 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 28

Accepted Solution

by:
pepr earned 250 total points
Comment Utility
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 28

Expert Comment

by:pepr
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Graph function 4 54
RCA to HDMI 4 52
Perl Write to Specific line in a file 15 50
How often can a passive RFID be polled? 10 39
Phishing is at the top of most security top 10 efforts you should be pursuing in 2016 and beyond. If you don't have phishing incorporated into your Security Awareness Program yet, now is the time. Phishers, and the scams they use, are only going to …
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Articles on a wide range of technology and professional topics are available on Experts Exchange. These resources are written by members, for members, and can be written about any topic you feel passionate about. Learn how to best write an article t…

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now