file-attributes

Getting specific file attributes

让人想犯罪 __ 提交于 2019-12-03 03:16:44
I've got a simple WCF service that lets clients/consumers upload image, audio or video files to it. After the upload, the service is supposed to analyze the file and somehow retrieve the following attributes: Image: width, height, date taken, program used Audio: runtime, artist, album, genre, bitrate, publication year Video: runtime, width, height, frames/sec, video bitrate, audio bitrate Apparently Windows can get and display these attributes pretty easily, but how do I do it in C#? Khepri Courtesty of this thread. I've verified this gets all file attributes including the extended attributes.

How to read or write the a s h r i file attributes on Windows using Python and ctypes?

人盡茶涼 提交于 2019-12-02 04:22:14
问题 For the records: a means 'archivable' s means 'system' h means 'hidden' r means 'readonly' i means 'indexable' My current solution to read/write these attributes from Python scripts is to call attrib using the subprocess module. Python code : import os, subprocess def attrib(path, a=None, s=None, h=None, r=None, i=None): attrs=[] if r==True: attrs.append('+R') elif r==False: attrs.append('-R') if a==True: attrs.append('+A') elif a==False: attrs.append('-A') if s==True: attrs.append('+S') elif

Does File Attribute contain millisecond? Objective-C

给你一囗甜甜゛ 提交于 2019-12-01 10:36:38
I would like to get milliseconds from creation time of file attribute When I get file attribute, I use NSDateFormatter to convert file creation time (NSDate) to NSString. [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss:SS: A"]; ss --> seconds SS --> should be millisecond A --> milliseconds of the date I get 00 for SS and get 54487000 for A. I notice that the last three digits are always zero for NSDate come from file attribute of any files. But when I use the same formatter with the NSDate come from [NSDate date], the last three digits are not zero for A, and SS digit is not always zero.

Does File Attribute contain millisecond? Objective-C

拜拜、爱过 提交于 2019-12-01 10:07:07
问题 I would like to get milliseconds from creation time of file attribute When I get file attribute, I use NSDateFormatter to convert file creation time (NSDate) to NSString. [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss:SS: A"]; ss --> seconds SS --> should be millisecond A --> milliseconds of the date I get 00 for SS and get 54487000 for A. I notice that the last three digits are always zero for NSDate come from file attribute of any files. But when I use the same formatter with the NSDate

Get File Creation Date Over HTTP

一曲冷凌霜 提交于 2019-12-01 03:28:19
Given a file on a webserver (e.g., http://foo.com/bar.zip -> only accessible through HTTP), is there any way to get the date attributes (e.g., date [created, modified]) without downloading the entire archive in the first place? Right now, I download the archive and read the attributes programmatically. Trouble is that the archive is dozens of MiB so it seems like a waste of resources to download the entire thing and end up reading off just a couple of bytes of information. I realize that bandwidth is practically free, but I don't like to be wasteful in any case. Try to read Last-Modified from

Testing for file attribute in batch file

南楼画角 提交于 2019-11-30 13:05:12
I'm writing a batch file and I need to know if a file is read only. How can I do that ? I know how to get them using the %~a modifier but I don't know what to do with this output. It gives something like -ra------. How can I parse this in batch file ? Something like this should work: @echo OFF SETLOCAL enableextensions enabledelayedexpansion set INPUT=test* for %%F in (%INPUT%) do ( set ATTRIBS=%%~aF set CURR_FILE=%%~nxF set READ_ATTRIB=!ATTRIBS:~1,1! @echo File: !CURR_FILE! @echo Attributes: !ATTRIBS! @echo Read attribute set to: !READ_ATTRIB! if !READ_ATTRIB!==- ( @echo !CURR_FILE! is read

File id for keeping track of file changes in Java?

[亡魂溺海] 提交于 2019-11-30 09:55:54
问题 I'm trying to find a way to keep track of files even when they are moved or renamed in the file system. One idea I had was to use the new UserDefinedFileAttributeView in Java 7 and create a custom file attribute as a sort of custom id. I thought that this might work on different platforms (Windows and Mac primarily). But I can't get it to work. Even trying the example on this page - http://docs.oracle.com/javase/tutorial/essential/io/fileAttr.html - When I get to this line:

Testing for file attribute in batch file

亡梦爱人 提交于 2019-11-29 18:35:50
问题 I'm writing a batch file and I need to know if a file is read only. How can I do that ? I know how to get them using the %~a modifier but I don't know what to do with this output. It gives something like -ra------. How can I parse this in batch file ? 回答1: Something like this should work: @echo OFF SETLOCAL enableextensions enabledelayedexpansion set INPUT=test* for %%F in (%INPUT%) do ( set ATTRIBS=%%~aF set CURR_FILE=%%~nxF set READ_ATTRIB=!ATTRIBS:~1,1! @echo File: !CURR_FILE! @echo

C# make file read/write from readonly

為{幸葍}努か 提交于 2019-11-29 03:03:48
If File.SetAttributes("C:\\myFile.txt", FileAttributes.ReadOnly); sets a file as read only, how do I set it back to read/write if I need to? I suspect it would be FileAttributes.Normal however will this change any other properties of the file? There isn't an awfully descriptive note on the MSDN site... The file is normal and has no other attributes set. This attribute is valid only if used alone. Thanks To remove just the ReadOnly attribute, you'd do something like this: File.SetAttributes("C:\\myfile.txt", File.GetAttributes("C:\\myfile.txt") & ~FileAttributes.ReadOnly); This will remove the

What does the dot at the end of the permissions in the output of “ls -lah” mean?

丶灬走出姿态 提交于 2019-11-27 22:37:57
问题 I found some Linux files, and when I type ls -lah , it outputs this permissions format: ... drwxr-xr-x. 2 root root ... -rw-rw-r--. 1 root root ... I would like to know, what is the meaning of the dot ( -rw-rw-r--. ) at the end of the permissions format? 回答1: From info coreutils 'ls invocation' under Linux GNU `ls' uses a `.' character to indicate a file with an SELinux security context, but no other alternate access method. A file with any other combination of alternate access methods is