Hi guys can you pint me in the direction or help me with creating a scrip to do the following. I have been readin many posts here and just can’t seam to get this right.
Heres the current structure
a-z folders
in each letter is several model names ex anna anna2 ariel etc.
In each girls folder is several sets gt102 mb312 te163 etc.
I need to create a zip each of the gt102 level folders and have the zip named modelname-foldername.zip in the a/anna/ folder.
If you have any questions or interested in doing this hit me up about it and we will work it out. Thank you.
icq 113 152 714 or email me charles at eent dot com but it has spam arrest so please verify or i will not get your message.
Not sure if this is a full solution for you but i guess its a step in the right Direction!
tell application "Finder"
set t to entire contents of (choose folder) as alias list
repeat with i in t
if name of item i is "gt102" then
set c to container of item i as alias
select item i
tell application "System Events"
tell process "Finder" to click menu item 21 of menu "File" of menu bar 1
display dialog "Archiving.. Please Wait." giving up after 1
tell application "Finder"
set the name of item "gt102.zip" of c to (name of c) & "_gt102.zip" as string
end tell
end tell
end if
end repeat
end tell
property baseDir : "myVolume:myDir:" -- the path to the folder which contains the a-z folders (with colon at the end!)
zip_folders("anna")
on zip_folders(ModelName)
set ModelDir to POSIX path of (baseDir & character 1 of ModelName & ":" & ModelName)
try
set theFolders to paragraphs 2 thru -1 of (do shell script "find " & quoted form of ModelDir & " -maxdepth 1 -type d")
repeat with oneFolder in theFolders
set folderName to name of (info for POSIX file oneFolder as alias)
try
text -3 thru -1 of folderName as integer -- test the last three characters as 3 digit number in e.g. gt102
set f_destination to ModelDir & "/" & ModelName & "-" & folderName & ".zip"
do shell script "/usr/bin/ditto -c -k -rsrc --keepParent " & quoted form of oneFolder & space & quoted form of f_destination
end try
end repeat
end try
end zip_folders
Did as StefanK suggested got the following response
tell current application
do shell script “find ‘/smb/::administrator/pass@192.168.1.14:kpc-content:/a/anna’ -maxdepth 1 -type d”
end tell
No would I not need to change
zip_folders(“anna”)
To be some variable so it goes through each model name not just anna?
this is how I entered it with the password removed for psoting purposes
property baseDir : “smb://administrator:pass@192.168.1.14/kpc-content/:” – the path to the folder which contains the a-z folders (with colon at the end!)
zip_folders(“anna”)
on zip_folders(ModelName)
set ModelDir to POSIX path of (baseDir & character 1 of ModelName & “:” & ModelName)
try
set theFolders to paragraphs 2 thru -1 of (do shell script “find " & quoted form of ModelDir & " -maxdepth 1 -type d”)
repeat with oneFolder in theFolders
set folderName to name of (info for POSIX file oneFolder as alias)
try
text -3 thru -1 of folderName as integer – test the last three characters as 3 digit number in e.g. gt102
set f_destination to ModelDir & “/” & ModelName & “-” & folderName & “.zip”
do shell script "/usr/bin/ditto -c -k -rsrc --keepParent " & quoted form of oneFolder & space & quoted form of f_destination
end try
end repeat
end try
end zip_folders