Compare Text file and SMB share

Hi
I need to work out a script that will compare 2-3000 folders I just cant do this manually, here is the problem.

I have a text file with a list of numbers:-
10002001
10002002
10002003
10002004
10002005
etc…

and I have a smb share named studhome with directories named as
10002001
10002002
10002003
10002004
10002005
etc…

There are aprox 2000 - 3000 entrys in the text file and smb share.

I need to compare the text file with the share and prefix the directory names with some kind of marker an X for example.

is this possible over an smb share? if so can anyone help get started with this one? If I have to do this manually I will go insane:P.

I can only test this on a afp volume, but I think it should work ok.


(*path to smb *)
property theDisk : ":Macintosh Hd:Volumes:TEST"
(*path to text folder *)
property theTextfilePath : "/Users/username/Desktop/TextFolder/"
(* text file name *)
property theTextfile : "Untitled.txt"
(*get folder list*)
tell application "Finder"
	set Smb_list to name of every folder of entire contents of alias theDisk
end tell
(*get list from file *)
set text_list to paragraphs of (do shell script "cat " & quoted form of (theTextfilePath & theTextfile as Unicode text))
(*compare lists *)
repeat with i from 1 to number of items in text_list
	set this_item to item i of text_list
	if this_item is in Smb_list then
(*add an (x) to end of item in text list if the folder name is found in the smb list *)
		set item i of text_list to (this_item & "(x)" & return as string)
	else
		set item i of text_list to (this_item & return as string)
		
	end if
end repeat
set text_list to text_list as string
(*make a new text file, with the updated list *)
set text_check_list to (do shell script "echo " & quoted form of text_list & " > " & quoted form of (theTextfilePath & "checked_" & theTextfile as Unicode text))

Can I ask what your end goal is??

Hi Mark,

Sorry for the delay.
Thanks for the reply & code, although I havn’t been able to test the script yet as the task has been pushed back a little while:rolleyes:. I will post with the outcome and ammended script (should it need amended) just as soon as I can.
As for the purpose of the script, the numbers relate to user home drives, I need to whittle out the old from the current and returning users before we migrate to a new domain.

Thanks again