Solved

automate copy file to a directory

Posted on 2011-03-17
10
445 Views
Last Modified: 2012-05-11
I need to copy a file to a directory pn a MAC OSX, but need to automate the process. With Automator I get an app and a file, and as long as they are both copied to the desktop, it works fine, but if the files are copied somewhere else, it doesn't. Ideally I need a self-contained package that contains both the command and the file, and puts the file into a directory when executed. Or at least a script that will copy the file as long it is in the same folder. Sorry, very limited mac experience.

Thanks for your help!
0
Comment
Question by:rookie_b
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 12

Expert Comment

by:nxnw
ID: 35161872
You really need to be clearer on what you are trying to do. I can think of a bunch of things you might mean, but have no idea which, if any, you are talking about.
0
 

Expert Comment

by:dataline
ID: 35163856
Hello,
there is a lot of options how to solve it. Some of them require some level of UNIX experience, some of them are purely visual. I would recommend using a folder script similar to:
on adding folder items to this_folder after receiving added_items
	tell application "Finder"
		move every item of container "VolumeName:Users:_your_shortname_:Desktop:transfer:" to "Volumes:_volume_name_:Folder:" with replacing
	end tell

Open in new window

0
 

Author Comment

by:rookie_b
ID: 35181908
Apologies for being unclear. I have a folder on the desktop with a file inside that needs to be copied to a specific subfolder in the applications folder. There are different users that need to do that, and from past experience at least a few will end up putting it in the wrong place. I want to prevent that by giving them a file on which they click and it does that for them. Because it is for different users, I cannot use absolute path, as every user would have a different one.

Thanks!
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 12

Expert Comment

by:nxnw
ID: 35182011
different users on the same machine? different applications folders on the same machine? different machines? does the file always have the same name? if so, is it ok to overwrite it?
0
 
LVL 10

Expert Comment

by:robertcerny
ID: 35182046
Hello,
use Automator for this task. Create a new Automator Application and use Copy Finder Items action.

Robert
0
 

Author Comment

by:rookie_b
ID: 35187992
I tried that, but itwon't work for other users, as the path would differe in the user part. I need something that would put it in the same relative path regardless of the user.
0
 
LVL 12

Expert Comment

by:nxnw
ID: 35188434
Please answer my questions. you will not get a useful answer until you provide a comprehensible explanation of what you are trying to do.
0
 

Author Comment

by:rookie_b
ID: 35333580
Hi nxnw,

i am sorry I did not get back to you earlier.

1. different users on the same machine -  Multiple machines with multiple users each (each machine is shared by 3-5 people)
2. different applications folders on the same machine - no, it is the same application folder for all machines
3. different machines - yes multiple machines, multiple users each
4. does the file have the same name - yes, the file has the same name
5. is it ok to be overwritten - yes, it needs to be overwritten

Thank you!
0
 
LVL 12

Accepted Solution

by:
nxnw earned 500 total points
ID: 35742999
Paste the following into applescript editor (substituting the correct names for the bold items) and save as an application.

try
      set theFile to (path to desktop folder as string) & "aFolder:" & "aFile" as alias
      set targetfolder to (path to applications folder as string) & "anotherFolder:" & "yetanotherFolder" as alias
on error errorMessage
      display dialog errorMessage buttons {"Cancel"} with title "Error"
end try

tell the application "Finder"
      move theFile to folder targetfolder with replacing
end tell
0
 
LVL 12

Expert Comment

by:nxnw
ID: 35743016
Just so you are clear, the above script will move ~/Desktop/aFolder/aFile (a file named "aFile", located in a folder named "aFolder" on the user's desktop) to /Applications/anotherFolder/yetanotherFolder
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CocoaPods is the best way to manage library dependencies in iOS and OS X projects. By using cocoa pods there is no need of downloading the code from github and copying to your project. There are plenty of open source libraries now available with C…
iCloud Drive was introduced after iOS 8 was launched last year. This drive is Apple’s online storage device that lets users sync their files and access them from all their Apple devices.   There is a lot of data that is not automatically backed up…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question