I need a command or something that will allow me to send a file to the current logged in Mac user without manually setting this file location up. Can this be done? Example I have a file called test.app I want to copy this to the users desktop. I don't know what the current users name is and I want it to be pickup automatically and then copy the file down to the user.
Copy a File to current login in users desktop Mac
1.5k Views Asked by Kyle At
2
There are 2 best solutions below
0
SchoolDev
On
To find out the all the users, use:
do shell script "cd /Users; ls"
return result
This should return the users in the "Result" tab in the Event Log at the bottom of the AppleScript Editor.
Then to copy test.app, use this:
do shell script "cp -R /path/to/test.app /Users/whateveruser/Desktop/test.app"
And that should copy the file to whatever users desktop you want.
Hope this helps!
Related Questions in SHELL
- macOS - Most secure way of a GUI SUDO_ASKPASS
- When does Bash read heredocs?
- Why `set -o pipefail` gives different output even though the pipe is not failing
- Run multiple shell scripts in Dockerfile
- Alias does not take effect when I use Vim to execute external commands
- why variable substitution is so different?
- Error: fish: ${ is not a valid variable in fish
- Custom Bash functions & custom statements - Need some advice
- unexpected operator == in square brackets when trying to use gum lib
- Delete first three lines containing a certain word
- Keep the log for the last 14 days
- Iterate over items in one array and groups of items in second array
- Keep multi-version of a static-lib like what we do for shared-libs
- How to write function in bash for reuse shell commands inside using osascript?
- Why is it that when I pass certain directory names to `ls`, sometimes it does not list their contents?
Related Questions in APPLESCRIPT
- Applescript To Select Sound Output stops at opening Sound Preferences Screen
- How do I react to external program launch inside an Automator workflow?
- Setting and getting Excel cell value in Applescript
- Need default PPT template to load across all computers in org
- AppleScript: How do I sort a list of sentences/paragraphs with an assigned number prefix?
- Using AppleScript (or Python PyObjC) to list out all applications in the Dock on Mac (All parts)
- Activating a Shortcut on 'hot-corner'
- Script to rename tags in Apple Photos
- unable to set permission read and write to volumes directory in macos 10.15
- AppleScript: "System Events" from Terminal not working
- Exporting PNGs from Photoshop using Apple Scripts
- AppleScript and SuperCard
- AppleScript do shell script find & replace in directory
- How to batch move PDFs from one folder to another using AppleScript?
- Applescript How to get the filename from open -a "xx.app" [file] --args "someargs" in the applescript
Related Questions in FILE-COPYING
- How to copy files to a destination, then delete the source files using a batch file/script?
- Can we make copy of a static file in Django?
- File Copy Locks File So Data Cannot Be Written
- How to copy finished ipk file to host /tmp after compilation?
- Why is fcopyfile faster than copyfile?
- Unable to copy multiple files non-interactively with single command
- filesystem::copy returns Invalid argument, but argument is existing fs::path variable
- Cannot overwrite an excel XLSM file with a lot of VBA because of Windows real-time protection
- Using PowerShell, can I copy one file from my local system to many remote computers in parallel?
- File.Move / File.Copy nothing happening
- How do I encrypt a file during transit/Copy
- Copying a subset of files (names contained in a vector) from one folder to another folder in R
- How to copy select files from subfolders to a single folder based on file paths saved in excel?
- Copy a file to a different place with a new name with python
- Progress bar when copying one large file in Python?
Related Questions in FILESHARE
- Azure Container App mounted volume - permission denied
- How to access mounted file from the application hosted on same EKS pod
- flutter fileshare default OS language settings
- Trouble Mounting Azure File Share in Kubernetes with UAMI: "Failed to Get Account Name from CSI" Error
- Fileshare service for application
- How to find backup vaults for an Azure blob container and file share using AZ CLI
- How can I copy one file from one folder to another within an Azure Fileshare using C#?
- Getting access denied error in accessing azure file share using Scandir function in PHP laravel
- Azure NFS file share upload issues
- Correct way to read and write files in Azure file share
- How get user details who modified files in fileshare in c#
- Robocopy to AWS Fileshare access denied errors
- The mapped network drive could not be created because the following error has occurred: The parameter is incorrect
- How to make All Folders, Sub-Folders & Files Read-Only EXCEPT for 4 Sub-Folders in a File Share?
- How to modify the file creation time of multiple files in single script
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Just use ~/Desktop/test.app as the file location. It will put it on the desktop of the current user.