INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Smart list that filters only "read only" files?  (Read 1753 times)

Windcrest77

  • Junior Woodchuck
  • **
  • Posts: 63
Smart list that filters only "read only" files?
« on: May 09, 2015, 02:41:46 pm »

How can I make a Smart List that will show me only audio files that have the disk "read only" flag checked?

Is there a function expression for this that I can use in a smart list?

I'm not even sure how to use a Function() as a smart list condition, so if there is a function available to tell if a file is read-only or not. How would I actually use it in a smart list?

Thanks

Logged

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Smart list that filters only "read only" files?
« Reply #1 on: May 09, 2015, 06:53:05 pm »

This is hard enough to do through explorer, I doubt it with MC.  If someone magically found a way it would be good to hear...

I'd use the command prompt

DIR /A:-D-R /S

If you expect a lot of results you can send to a text file by adding ReadOnly.txt to the end of that string
Logged

Windcrest77

  • Junior Woodchuck
  • **
  • Posts: 63
Re: Smart list that filters only "read only" files?
« Reply #2 on: May 10, 2015, 01:02:51 pm »

Thanks,

I know very easy to inquire that flag (and all the file property flags) using C# in a Windows .Net program, I thought maybe someone would ave written a JRiver function. Yes I do have a lot of files that re read only so I have to constantly open explorer and enable write to tag them.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Smart list that filters only "read only" files?
« Reply #3 on: May 10, 2015, 01:09:18 pm »

I don't think MC reads that file attribute into a Library Field, so there's no way to query it from within MC.  It could, but it doesn't.

For the record, though, testing read-only vs. read-write status is actually somewhat challenging, even in C# (I know, I've messed with it a ton).  The only really reliable way is to try to write to the file or folder, unfortunately. You can query a bunch of things, but there are a ton of interlocking items that can cause a filesystem location to be read-only, and not all are easy to query:

* Read-only attribute on the file.
* Filesystem permissions on the file, or any of its parent directories.
* Network share permissions on the hosting share.
* Entire volume mounted read-only.
* Writing to the disk is physically disabled (this is, obviously, much more rare than in the days of floppies, but can happen with encrypted containers, optical discs, and disk images still).
* Filesystem corruption or errors.

Usually the simplest method is to try to write to it, and catch any exceptions thrown.

Why not just fix the entire directory structure at once? Where are these read-only files coming from?
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

Windcrest77

  • Junior Woodchuck
  • **
  • Posts: 63
Re: Smart list that filters only "read only" files?
« Reply #4 on: May 11, 2015, 12:55:39 am »

In .Net Framework I use the IsReadOnly flag of the FileInfo class:

https://msdn.microsoft.com/en-us/library/system.io.fileinfo(v=vs.110).aspx

I'll just have to keep setting the files as I find them.

Thanks

Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Smart list that filters only "read only" files?
« Reply #5 on: May 11, 2015, 01:02:05 am »

Right. That only checks the file attribute.

You know you can select an entire directory in Windows Explorer and unset that attribute for all contained files (including those in subdirectories) at once, right?  Why not just fix them all at once?
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: Smart list that filters only "read only" files?
« Reply #6 on: May 11, 2015, 01:06:40 pm »

+1 Glynor.

Fix the SOURCE of the issue, don't just keep chasing it.  Remove the read only attribute from the entire structure at once and be done with it.  :)

Brian.
Logged
Pages: [1]   Go Up