Folder Checking and Labels...

:confused:

Hi all, hope this year has been a fruitful one for everyone…

I am in a sticky situation and can to seem to find a solution, all the scripter I have asked here in SA are also lost…
I am sure this is an easy task and I am jjust missing the boat somewhere can you guys have a look and let me know what I am doing wrong, heres the problem.

I had a shared drive on a ready NAS that has multiple folders, I.E. shared folder - Masters, inside this folder is, Backup 1, Backup 2, Backup 3, Backup 4. , Once Backup 1 reaches 4gig in size I need to change the label to orange, Backup 2 has 2 sub folders that need to be checked separately and the same needs to apply.
firstly is this possable,
secondly has this been done
thirdly can some one please help me with this.

My scripts work today then the same script does not work tomorrow, I have attached what I have gotten to work so fer but the rest is a blank.

[b]tell application “Finder”
activate
–get label index of folder (whose name begins with “DVD”) of disk “SessionArchives”
make new Finder window to disk “SessionArchives”
get label index of (every folder of front Finder window) as list

if label index is equal to 3 then
	set label index of (folder of front Finder window whose size is greater than 4.0E+9) to 1
else
	
	--set label index of (every folder of front Finder window whose size is less than 4.0E+9) to 3
end if

end tell[/b]

Any help would greatly appreciated, I am a beginner, and this is bugging me broken…

ok I guess no one can help me here lol

I will keep looking but I am not having any joy…

Thanks anyway.

:confused:

Moved the topic to the appropriate forum :cool:

Thanks for that, hope some one can help me with this, it has been a problem for some time now…

Hmmmm

:slight_smile:

Hi,

a NAS could have its own rules.

First off all: Do you have sufficient access privileges to change the labels (writing permission is required).
Second of all: It’s not necessary to open a Finder window to manipulate the contents of a folder

You can do something like this


tell application "Finder"
	set currentFolder to folder "Backup1" of disk "SessionArchives"
	set labelIndex to label index of currentFolder
	if labelIndex is equal to 3 then
		if size of currentFolder > 4.0E+9 then set label index of currentFolder to 1
	end if
end tell

I am a system admin on the NAS, there are no limitations for me on this system…

Could it be that easy???

ok the scripts working now I need to check the rest of the disk, so I guess I will need a loop script of some sort?

something like this


property folderList : {"SessionArchives:Backup1:", "disk:path:to:folder1:", "disk:path:to:folder2:"}

repeat with oneFolder from 1 to (count folderList)
	tell application "Finder"
		set currentFolder to folder (item oneFolder of folderList)
		set labelIndex to label index of currentFolder
		if labelIndex is equal to 3 then
			if size of currentFolder > 4.0E+9 then set label index of currentFolder to 1
		end if
	end tell
end repeat

or


.
repeat with oneFolder from 1 to (count folderList)
	tell application "Finder"
		tell folder (item oneFolder of folderList)
			if label index is equal to 3 and size > 4.0E+9 then
				set label index to 1
			end if
		end tell
	end tell
end repeat

Thanks for the help, I will try it and see what I come up with, I will post the results here when I have some.