SETATTRIB help

Good day to everyone who read this.
I need a little of help with this issue:
I save my music in folders ordered by artist\album, in conjunction with the lyrics (lrc files) and the covers (jpg files). What I wanna to do is set the audio files (mp3,wma,flac) read-only, and the lrc and jpg files set off the read-only attribute.
I tried creating filters such:Name coincide with *.lrc and ATTR read-only is on and the button:

SetAttr CLEARATTR=r FILTER=Lyrics RECURSE 

just to try in the lrc files in first place, but it doesn't work.
What I'm doing wrong?

Try following code (LMB sets music files +r, RMB sets the other files to -r)

<?xml version="1.0"?> <button backcol="none" display="both" textcol="none" type="three_button"> <label>read only music</label> <icon1>#newcommand</icon1> <button backcol="none" display="both" textcol="none"> <label>set all Attr r</label> <icon1>#newcommand</icon1> <function type="normal"> <instruction>select *.(mp3|wma|flac)</instruction> <instruction>SetAttr Attr=r</instruction> </function> </button> <button backcol="none" display="both" textcol="none"> <label>-r for non-music</label> <icon1>#newcommand</icon1> <function type="normal"> <instruction>Select *.(jpg|jpeg|lrc)</instruction> <instruction>SetAttr CLEARATTR=r</instruction> </function> </button> </button>

[quote="instigator"]Good day to everyone who read this.
I need a little of help with this issue:
I save my music in folders ordered by artist\album, in conjunction with the lyrics (lrc files) and the covers (jpg files). What I wanna to do is set the audio files (mp3,wma,flac) read-only, and the lrc and jpg files set off the read-only attribute.
I tried creating filters such:Name coincide with *.lrc and ATTR read-only is on and the button:

SetAttr CLEARATTR=r FILTER=Lyrics RECURSE 

just to try in the lrc files in first place, but it doesn't work.
What I'm doing wrong?[/quote]

That looks correct to me, unless there is a mistake in the filter definition.

I created two filters; Lyrics:


and Music:


Then I created a button which ran this:

SetAttr SETATTR=r FILTER=Music RECURSE SetAttr CLEARATTR=r FILTER=Lyrics RECURSE

If I select some folders and click the button, it clears the R attribute on *.lrc and sets it on *.(mp3|wma|flac)

(Maybe you weren't selecting anything for the command to run on? If you want it to run on everything below the current directory without having to select anything, you should be able to do that with a slightly different command.)

[ul][li]Note: The filter only applies to the recursion (i.e. the items below the selected folders). Any files & folders which are actually selected will have their attributes modified regardless of what the filter says. That's why I did the set-R before the clear-R, so that the selected files end up without R set. But if some folders were meant to have R set (e.g. it's used to indicate their icon has been 'customized') then you wouldn't want it to be cleared...

If you want to avoid messing with the top-level folders' R attributes I think a different approach is needed, but hopefully it's not an issue.[/li][/ul]

I created the same filters:
Lyrics


and Music:


and the same button code:

SetAttr SETATTR=r FILTER=Music RECURSE SetAttr CLEARATTR=r FILTER=Lyrics RECURSE
This is how it looks the files inside the folder that I selected before press the button:


and after:


You can see that there's no change, However, if I select the files directly, everything is set to not read-only.
Why?

Go up one level and select the folder you were in, then run the button.

(The SetAttr command's filter is only applied when going inside of selected directories. The actual directories, and any files, which are selected at the top level will always be affected by the SetAttr command, regardless of whether or not the filter matches them. To put it another way, if you click and select an item, the filter doesn't matter for that item; the filter only matters for things found inside the folders you clicked and selected.)

I already doing that. I run the button with the folder selected.

The images of the files that I upload, show the files inside the folder selected, I'm not run the button directly on the files.

I've checked on a vanilla install and it seems to work fine. Here is exactly what I am doing...

I created three test folders, with only the files in the first folder all set read-only to start with:


I created these two filters:




I created this button:


Then I selected the folders and clicked the button:


Here is the result, with the original attributes (from the first screenshot) next to the new ones for easy comparison:


I don't understand, I'm doing exactly the same. Every step. But doesn't work.
The mp3|flac|wma files are set to not read-only (no matter the original attribute), and the lrc doesn't change.
Is something wrong with my Dopus?
Also, How can I get the three View of the setattr_1.png? :smiley:

Go {f} Set FLATVIEW=On,Grouped

Go {f} Set FLATVIEW=On,Grouped[/quote]

(Not sure why you'd want the Go command there.)

You can turn on Flat View via the View menu without having to make a custom command/button.

It depends, if i want to run it from inside a directory (= your suggestion) or from outside (like in the button).

Look. The filters.



The button:


Then I select the test folders and run the button, and this happens:

If you manually change the R attribute on some of those files, does it work?

Are you using Opus 9.5.6.0?

[quote="leo"]If you manually change the R attribute on some of those files, does it work?

Are you using Opus 9.5.6.0?[/quote]
Yes, I'm using the 9.5.6.0 version, and no, even if I change manually the attributes, do the same.

If you can't change the attributes manually then the problem may be that you don't have permission to modify those files (or the folders they are in; I'm not sure exactly which permission controls the ability to set attributes, off the top of my head).

[quote="leo"]If you manually change the R attribute on some of those files, does it work?

Are you using Opus 9.5.6.0?[/quote]
Oh no sorry I understand wrong your answer, I can change manually the attributes.