:? Is there a way to make or duplicate multiple copies of a file ?
What I’m trying to do is this, get the info on how many times a file needs to be copied from a text file. (which works )But now I need to be able to have multiple copies made using the info that I get from the same text file. (which I get just fine) Is this possible?
P.S. sorry for the long post I’m new at this but trying to learn[/i]
If you’re using “tell app finder to duplicate alias x”, it should return a file spec for the new file, which you can use to apply modifications:
tell app "Finder"
duplicate alias "HD:file.txt"
--> returns, eg, file "file copy.txt" of startup disk of app "Finder"
set name of result to "hi!.txt"
end tell
For multiple files:
set files_to_duplicate to {alias "HD:file1.txt", alias "HD:file2.txt"}
repeat with i in files_to_duplicate
-- where "i" is a reference to item x of files_to_duplicate
-- so, tell app finder to duplicate & rename
end repeat
If your text file gives you a number, you can use it in a repeat loop. Something like this might work.
set numFromTextFile to 4
tell application "Finder"
repeat numFromTextFile times
duplicate alias "path:to:file"
end repeat
end tell