Hello,
I want to be able to search a mounted server for all the old folders and be able to tell how many files are in there and how much space they are taking up on the server. Here is what I have so far.
tell application "Finder"
mount volume "afp://username:password@192.168.1.xx/TestServer"
set myVar to (do shell script "mdfind -onlyin /Volumes/TestServer kMDItemKind == " & ("Folder") & " | grep " & "\"" & "Old" & "\"")
set the clipboard to myVar as text
local newClip, msg, userDesk, clip, f
tell application (path to «constant afdregfp» as string)
try
set newClip to the clipboard as text
on error
display dialog "I couldn't find text in the clipboard!" with icon stop
error number -128
end try
try
set newClip to «class ktxt» of (newClip as Unicode text as record)
on error msg
display dialog "Error processing the data..." & return & msg with icon stop
error number -128
end try
set userDesk to (path to desktop as text)
set clip to 1
repeat
set f to (userDesk & "clip" & clip & ".txt")
try
f as alias
set clip to clip + 1
on error
exit repeat
end try
end repeat
set f to (open for access file f with write permission)
write newClip to f
close access f
end tell
tell application "Finder"
set myHiddenTextFile to (choose file with prompt "Select File" of type {"TEXT"})
open for access myHiddenTextFile
set myHiddenTextFileContent to read myHiddenTextFile using delimiter {return}
close access myHiddenTextFile
set txtvar1 to item 1 of myHiddenTextFileContent as POSIX file
repeat
try
set folderSize to (physical size of folder txtvar1) as integer
exit repeat
on error
delay 3
end try
end repeat
set folderSize to folderSize / 1024 / 1024 as integer
if folderSize = 0 then
display dialog "There are no files in the old folder/s"
else
display dialog "There are " & folderSize & " MB worth of files in the old folder/s"
end if
end tell
end tell
I am not sure how to get around the prompting for the “clip1.txt” file. I want to set that variable without a prompt. There is also another issue where I can only check the size of 1 folder at a time. anybody got any suggestions? i realize this is a really bad applescript file. I’m new to this. I’ll take any advice that I can. Thanks in advance!!!