Question regarding create/read/update file attributes in code
Questions tagged [file-attributes]
185 questions
4
votes
1 answer
Possible bug in Matlab's "fileattrib" function. Workaround?
I have found some strange behaviour in Matlab's fileattrib function on Windows. With certain file names it wrongly identifies the file as a hidden, system folder.
To test it, download this file (the file is empty; it's only the file name that…

Luis Mendo
- 110,752
- 13
- 76
- 147
4
votes
2 answers
How to change read attribute for a list of files?
I am powershell newbie. I used a sample script and made substitute from get-item to get-content in the first line.
The modified script looks like below:
$file = get-content "c:\temp\test.txt"
if ($file.IsReadOnly -eq $true)
{
$file.IsReadOnly =…

ds555
- 41
- 1
3
votes
1 answer
Does File Attribute contain millisecond? Objective-C
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 -->…

BB.
- 707
- 2
- 11
- 22
3
votes
1 answer
File.SetAttributes() not working on USB key as expected
FileAttributes attrs = File.GetAttributes( path);
File.SetAttributes( path, FileAttributes.Hidden );
attrs = File.GetAttributes( path);
This code snippet works on my NTFS file system (C:\Temp...\whatever_file). But when I try to perform this same…

dviljoen
- 1,612
- 1
- 16
- 28
3
votes
2 answers
Get attributes of all files under a directory while accessing the directory only
I'm trying to write a function in C# that gets a directory path as parameter and returns a dictionary where the keys are the files directly under that directory and the values are their last modification time.
This is easy to do with…

Yoni
- 275
- 2
- 4
- 8
3
votes
0 answers
Is there any way to set custom (aka user defined) file attributes on a file in Android?
I need to set user defined attributes for 2 reasons, 1- to mark encrypted files, 2- implementing a tag system like MacOS' Finder has.
Here's what I've tried:
Files.setAttribute(
…

Shazniq
- 423
- 4
- 16
3
votes
3 answers
Working with File Attributes in C# .Net 2.0
So how can i recursively search a Folder and un-hide ALL files and sub folders in a directory? Like have it check each file and each folder... if they're hidden.. un-hide them. Iv been messing around with it all morning with no luck... i got all…

NightsEVil
- 507
- 2
- 13
- 21
3
votes
2 answers
Read file attibutes for all files in the tree using as few IO operation as possible
I have a lot of small files on a NFS drive (Amazon EFS in my case). Files are provided over HTTP protocol, very similar to a classical Web-Server it does. As I need to validate the last modification of the file, it takes at least a single I/O per…

30thh
- 10,861
- 6
- 32
- 42
3
votes
1 answer
How to get extended file-attributes in Windows in Python/Go/C/Batch?
I have searched a lot and have got some findings on how to get extended FA, but they are in C# using the language's own built-in APIs. I am trying to find the author name for a file in Windows, but my requirement is in Go/Python/C/Batch (order of…

bitbyter
- 801
- 1
- 8
- 17
3
votes
2 answers
Sort files in directory using extended file attributes
I have a number of files in a directory, and I add extended file attributes to them
setfattr -n user.processorder -v 2 myfile.txt
I was wondering, is it possible to iterate over the files in the directory with a FOR loop but sorting them according…

miduarte
- 83
- 1
- 8
3
votes
1 answer
Swift3.0 fileAttributes throws "no such file" error on existing file
I am quite new to Swift and I am trying to implement a file creation date check.
The idea is to check if the file was created longer than 7 days ago. For some reason the code always returns "no such file" error.
To check what is wrong i used the…

Karl Valliste
- 33
- 3
3
votes
0 answers
Read custom attributes of a file or folder in python
I set an attribute for a file/folder using Java's UserDefinedFileAttributeView. Please find the code snippet as below:
UserDefinedFileAttributeView userView = Files.getFileAttributeView(file,…

Viswanath Duddu
- 59
- 5
3
votes
1 answer
Windows Batch, for loop and file attributes while calling another batch
I recently started converting all my video files to MP4 for streaming purposes, and was using batch so far without issues.
Now I have 6000+ videos to convert and needed some sort of queue system I could manipulate.
This is my current code to convert…

totalvamp
- 75
- 1
- 7
3
votes
4 answers
How Do I Programmatically Set a File Tag
When using Windows Explorer to view files, I'm given the option to set a "tag", "category", or other attributes. For a JPEG a different set of attributes (including "tag") are options. I'd like to be able to set these programmatically.
How do I…

Greg Bishop
- 517
- 1
- 5
- 16
3
votes
1 answer
FileInfo.IsReadOnly versus FileAttributes.ReadOnly
Is there any difference between these two ways of checking whether a file is read-only?
Dim fi As New FileInfo("myfile.txt")
' getting it from FileInfo
Dim ro As Boolean = fi.IsReadOnly
' getting it from the attributes
Dim ro As Boolean =…

jor
- 2,058
- 2
- 26
- 46