đŸ•·ïž Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 123 (from laksa147)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

â„č Skipped - page is already crawled

📄
INDEXABLE
✅
CRAWLED
1 day ago
đŸ€–
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://iboysoft.com/tips/copy-file-macos-terminal.html
Last Crawled2026-04-05 15:41:47 (1 day ago)
First Indexed2024-05-11 01:39:16 (1 year ago)
HTTP Status Code200
Meta TitleHow to Copy a File/Directory in macOS Terminal? (cp command)
Meta DescriptionThis article explains how to copy a file or directory in macOS Terminal using the cp command, with detailed examples.
Meta Canonicalnull
Boilerpipe Text
While it's easy to copy a file or directory in Finder, executing the cp command in  Terminal  allows you to copy files faster, bash copy all files in a directory and subdirectories without opening windows in Finder, and interact with hidden files. This article will teach you how to copy files or directories in macOS Terminal with the cp command. cp command : Shortened for "copy," the cp command on Mac is used to copy files and directories locally. If you want to learn all the usages of the cp command, run "man cp" in Terminal. In the following sections, we'll discuss its common usage. How to quickly get the path to the file or folder you want to copy? The easiest way to get the file path on Mac is by dragging and dropping the file or folder into the Terminal window. For instance, if you want to get the file path of the Documents folder, simply drag and drop it into the Terminal window. How to copy a file or directory on Mac through Terminal?   Note:  Make sure you enter the correct command with the needed empty spaces, as each part of the command is separated by a space. Otherwise, the command won't work. When copying a file or directory locally on Mac: To copy a single file in Terminal: cp file_path destination_directory_path E.g., To copy a file named test.png from the desktop to the Documents folder: cp /Users/jenny/Desktop/test.png /Users/jenny/Documents To copy and rename a file on Mac with Terminal: cp file_path renamed_file_path To copy and rename test.png to test-copy.png: cp /Users/jenny/Desktop/test.png /Users/jenny/Desktop/test-copy.png. To copy a folder and its contents in Terminal: cp -R folder_path destination_directory_path E.g., To copy a folder named test and its directories and sub-directories in macOS Terminal to the Documents folder: cp -R /Users/jenny/Desktop/test /Users/jenny/Documents   Note:  The R flag tells the cp command to copy everything inside the designated folder. How to copy multiple files from one directory to another in Terminal? To copy contents of one directory to another in Terminal rather than the directory itself: cp -R source_directory/ destination_directory_path E.g., To copy files in the test folder on your desktop to the Documents folder:  cp -R /Users/jenny/Desktop/test/ /Users/jenny/Documents (Notice the forward slash (/) used at the end of the source directory? This is the key to copying only contents, not the directory.) To copy a specific file type to another directory in Terminal: cp *.file_type destination_directory_path E.g., To copy all txt files to your desktop: cp *.txt /Users/jenny/Desktop/ To copy selected files to another directory in Terminal: cp file_path1 file_path2 destination_directory_path E.g., To copy 2 files from the test folder on your desktop to the Documents folder: cp /Users/jenny/Desktop/test/picture1.png /Users/jenny/Desktop/test/picture2.png /Users/jenny/Documents To bash copy all files in directories and subdirectories: cp -R folder_path1 folder_path2 destination_directory_path E.g., To bash copy all files in the test1 and test2 folders on your desktop to the Documents folder: cp -R /Users/jenny/Desktop/test1 /Users/jenny/Desktop/test2 /Users/jenny/Documents   Tips:  The Mac Terminal commands used above can also be used to copy files to an external hard drive on Mac. Share this post to help others copy files in macOS Terminal! To copy a specific hidden file: cp hidden_file_path destination_directory_path E.g., To copy a hidden file named .config to the backup folder on your desktop: cp /Users/jenny/.config /Users/jenny/Desktop/backup/ To copy all files including hidden ones, from one directory to another: cp -R source_directory_path/{.*,*} destination_directory_path E.g., To copy all files, including hidden items from the test folder to the backup folder: cp -R /Users/jenny/Desktop/test/{.*,*} /Users/jenny/Desktop/backup/ macOS script to copy files on Mac with the cp command If you're looking to create a script on macOS to copy files using the cp command, take the following steps: Open Terminal. Create a script with a text editor like Nano. (for instance, copy_files.sh) nano copy_files.sh Copy and paste the following script into the file. (Ensure you replace the source_directory_path and destination_directory_path.) Press Ctrl + o to write the changes, then press Enter, and then Ctrl + X to exit. Give the script execution permissions. chmod +x copy_files.sh Now you can run the script. ./copy_files.sh If you find this post helpful, share it to benefit others who want to learn how to copy files or directories in Mac Terminal. Also Read: How to Rename a File or Multiple Files in macOS Terminal?
Markdown
1. [Home](https://iboysoft.com/) 2. [News Tips](https://iboysoft.com/tips/) # How to Copy a File/Directory in macOS Terminal with the cp command? Updated on Thursday, April 2, 2026 ![iBoysoft author Jenny Zeng](https://iboysoft.com/images/authors/11-Jenny-Zeng.jpg) Written by [Jenny Zeng](https://iboysoft.com/author/jenny.html) ![Professional tech editor](https://iboysoft.com/images/authors/8-Jessica-Shee.jpg) Approved by [Jessica Shee](https://iboysoft.com/author/jessica.html) *English* [*Français*](https://iboysoft.com/fr/nouvelles/copier-fichier-macos-terminal.html) [*Deutsch*](https://iboysoft.com/de/nachricht/datei-kopieren-macos-terminal.html) [*ă‚„ăŸăš*](https://iboysoft.com/jp/news/copy-file-macos-terminal.html) [*Español*](https://iboysoft.com/es/noticias/copiar-archivo-macos-terminal.html) [*PortuguĂȘs*](https://iboysoft.com/pt/noticias/copiar-arquivo-macos-terminal.html) Table of contents - [1\. How to copy a file or directory on Mac through Terminal?](https://iboysoft.com/tips/copy-file-macos-terminal.html#how-to-copy-a-file-or-directory-on-mac-through-terminal?) - [2\. How to copy multiple files from one directory to another in Terminal?](https://iboysoft.com/tips/copy-file-macos-terminal.html#how-to-copy-multiple-files-from-one-directory-to-another-in-terminal?) - [3\. How to copy hidden files in Mac Terminal?](https://iboysoft.com/tips/copy-file-macos-terminal.html#how-to-copy-hidden-files-in-mac-terminal?) - [4\. macOS script to copy files on Mac with the cp command](https://iboysoft.com/tips/copy-file-macos-terminal.html#macos-script-to-copy-files-on-mac-with-the-cp-command) While it's easy to copy a file or directory in Finder, executing the cp command in [Terminal](https://iboysoft.com/wiki/mac-terminal.html) allows you to copy files faster, bash copy all files in a directory and subdirectories without opening windows in Finder, and interact with hidden files. This article will teach you **how to copy files or directories in macOS Terminal** with the cp command. **cp command**: Shortened for "copy," the cp command on Mac is used to copy files and directories locally. If you want to learn all the usages of the cp command, run "man cp" in Terminal. In the following sections, we'll discuss its common usage. ### How to quickly get the path to the file or folder you want to copy? The easiest way to get the file path on Mac is by dragging and dropping the file or folder into the Terminal window. For instance, if you want to get the file path of the Documents folder, simply drag and drop it into the Terminal window. ![How to quickly get file path on Mac](https://iboysoft.com/images/en-news/copy-file-macos-terminal/how-to-get-file-path-on-mac.jpg) ## How to copy a file or directory on Mac through Terminal? Note: Make sure you enter the correct command with the needed empty spaces, as each part of the command is separated by a space. Otherwise, the command won't work. When copying a file or directory locally on Mac: To copy a single file in Terminal: cp file\_path destination\_directory\_path E.g., To copy a file named test.png from the desktop to the Documents folder: cp /Users/jenny/Desktop/test.png /Users/jenny/Documents ![How to copy a file in Mac Terminal](https://iboysoft.com/images/en-news/copy-file-macos-terminal/copy-a-file-in-mac-terminal.jpg) To copy and rename a file on Mac with Terminal: cp file\_path renamed\_file\_path To copy and rename test.png to test-copy.png: cp /Users/jenny/Desktop/test.png /Users/jenny/Desktop/test-copy.png. ![How to copy and rename a file in Mac Terminal](https://iboysoft.com/images/en-news/copy-file-macos-terminal/copy-and-rename-s-file-in-terminal.jpg) To copy a folder and its contents in Terminal: cp -R folder\_path destination\_directory\_path E.g., To copy a folder named test and its directories and sub-directories in macOS Terminal to the Documents folder: cp -R /Users/jenny/Desktop/test /Users/jenny/Documents ![How to copy a folder and its contents in Terminal](https://iboysoft.com/images/en-news/copy-file-macos-terminal/how-to-copy-a-folder-and-its-content-in-terminal.jpg) Note: The R flag tells the cp command to copy everything inside the designated folder. ## How to copy multiple files from one directory to another in Terminal? To copy contents of one directory to another in Terminal rather than the directory itself: cp -R source\_directory/ destination\_directory\_path E.g., To copy files in the test folder on your desktop to the Documents folder: cp -R /Users/jenny/Desktop/test/ /Users/jenny/Documents (Notice the forward slash (/) used at the end of the source directory? This is the key to copying only contents, not the directory.) ![How to copy contents of one directory to another in Terminal](https://iboysoft.com/images/en-news/copy-file-macos-terminal/copy-contents-of-one-directory-to-another-in-terminal.jpg) To copy a specific file type to another directory in Terminal: cp \*.file\_type destination\_directory\_path E.g., To copy all txt files to your desktop: cp \*.txt /Users/jenny/Desktop/ To copy selected files to another directory in Terminal: cp file\_path1 file\_path2 destination\_directory\_path E.g., To copy 2 files from the test folder on your desktop to the Documents folder: cp /Users/jenny/Desktop/test/picture1.png /Users/jenny/Desktop/test/picture2.png /Users/jenny/Documents ![How to copy multiple files in Mac Terminal](https://iboysoft.com/images/en-news/copy-file-macos-terminal/copy-multiple-files-to-another-directory-in-terminal.jpg) To bash copy all files in directories and subdirectories: cp -R folder\_path1 folder\_path2 destination\_directory\_path E.g., To bash copy all files in the test1 and test2 folders on your desktop to the Documents folder: cp -R /Users/jenny/Desktop/test1 /Users/jenny/Desktop/test2 /Users/jenny/Documents ![how to bash copy all files in directories and subdirectories](https://iboysoft.com/images/en-news/copy-file-macos-terminal/bash-copy-all-files-in-directories-and-subdirectories.jpg) Tips: The Mac Terminal commands used above can also be used to copy files to an external hard drive on Mac. Share this post to help others copy files in macOS Terminal\! ## How to copy hidden files in Mac Terminal? To copy a specific hidden file: cp hidden\_file\_path destination\_directory\_path E.g., To copy a hidden file named .config to the backup folder on your desktop: cp /Users/jenny/.config /Users/jenny/Desktop/backup/ To copy all files including hidden ones, from one directory to another: cp -R source\_directory\_path/{.\*,\*} destination\_directory\_path E.g., To copy all files, including hidden items from the test folder to the backup folder: cp -R /Users/jenny/Desktop/test/{.\*,\*} /Users/jenny/Desktop/backup/ ## macOS script to copy files on Mac with the cp command If you're looking to create a script on macOS to copy files using the cp command, take the following steps: 1. Open Terminal. 2. Create a script with a text editor like Nano. (for instance, copy\_files.sh)nano copy\_files.sh 3. Copy and paste the following script into the file. (Ensure you replace the source\_directory\_path and destination\_directory\_path.) ![The macOS script to copy files on Mac with the cp command](https://iboysoft.com/images/en-news/copy-file-macos-terminal/macos-script-to-copy-files-on-mac-with-the-cp-command.jpg) 4. Press Ctrl + o to write the changes, then press Enter, and then Ctrl + X to exit. 5. Give the script execution permissions.chmod +x copy\_files.sh 6. Now you can run the script../copy\_files.sh ![How to run the macOS Script to copy files in Terminal](https://iboysoft.com/images/en-news/copy-file-macos-terminal/run-macos-script-to-copy-files-in-terminal.jpg) If you find this post helpful, share it to benefit others who want to learn how to copy files or directories in Mac Terminal. Also Read: [How to Rename a File or Multiple Files in macOS Terminal?](https://iboysoft.com/tips/rename-file-macos-terminal.html) ![iBoysoft author Jenny Zeng](https://iboysoft.com/images/authors/11-Jenny-Zeng.jpg) [Jenny Zeng](https://iboysoft.com/author/jenny.html) Jenny is a technical writer at iBoysoft, specializing in computer-related knowledge such as macOS, Windows, hard drives, etc. She's also been producing top-notch articles for other famous technical magazines and websites. ![Professional tech editor](https://iboysoft.com/images/authors/8-Jessica-Shee.jpg) [Jessica Shee](https://iboysoft.com/author/jessica.html) Jessica Shee is a senior tech editor at iBoysoft. Throughout her 4 years of experience, Jessica has written many informative and instructional articles in data recovery, data security, and disk management to help a lot of readers secure their important documents and take the best advantage of their devices. Policies [Refund Policy](https://iboysoft.com/refund-policy.html) [Privacy Policy](https://iboysoft.com/privacy-policy.html) [License Agreement](https://iboysoft.com/license-agreement.html) [Uninstall](https://iboysoft.com/uninstall.html) No. 308, 3/F, Unit 1, Building 6, No. 1700, Tianfu Avenue North, High-tech Zone Copyright© 2026 iBoysoftÂź. All Rights Reserved. [![DMCA.com Protection Status](https://images.dmca.com/Badges/_dmca_premi_badge_4.png?ID=9d966a8c-503f-40ae-b91a-6eadc7e7ad50)](https://www.dmca.com/Protection/Status.aspx?ID=9d966a8c-503f-40ae-b91a-6eadc7e7ad50 "DMCA.com Protection Status")
Readable Markdown
While it's easy to copy a file or directory in Finder, executing the cp command in [Terminal](https://iboysoft.com/wiki/mac-terminal.html) allows you to copy files faster, bash copy all files in a directory and subdirectories without opening windows in Finder, and interact with hidden files. This article will teach you **how to copy files or directories in macOS Terminal** with the cp command. **cp command**: Shortened for "copy," the cp command on Mac is used to copy files and directories locally. If you want to learn all the usages of the cp command, run "man cp" in Terminal. In the following sections, we'll discuss its common usage. ### How to quickly get the path to the file or folder you want to copy? The easiest way to get the file path on Mac is by dragging and dropping the file or folder into the Terminal window. For instance, if you want to get the file path of the Documents folder, simply drag and drop it into the Terminal window. ![How to quickly get file path on Mac](https://iboysoft.com/images/en-news/copy-file-macos-terminal/how-to-get-file-path-on-mac.jpg) ## How to copy a file or directory on Mac through Terminal? Note: Make sure you enter the correct command with the needed empty spaces, as each part of the command is separated by a space. Otherwise, the command won't work. When copying a file or directory locally on Mac: To copy a single file in Terminal: cp file\_path destination\_directory\_path E.g., To copy a file named test.png from the desktop to the Documents folder: cp /Users/jenny/Desktop/test.png /Users/jenny/Documents ![How to copy a file in Mac Terminal](https://iboysoft.com/images/en-news/copy-file-macos-terminal/copy-a-file-in-mac-terminal.jpg) To copy and rename a file on Mac with Terminal: cp file\_path renamed\_file\_path To copy and rename test.png to test-copy.png: cp /Users/jenny/Desktop/test.png /Users/jenny/Desktop/test-copy.png. ![How to copy and rename a file in Mac Terminal](https://iboysoft.com/images/en-news/copy-file-macos-terminal/copy-and-rename-s-file-in-terminal.jpg) To copy a folder and its contents in Terminal: cp -R folder\_path destination\_directory\_path E.g., To copy a folder named test and its directories and sub-directories in macOS Terminal to the Documents folder: cp -R /Users/jenny/Desktop/test /Users/jenny/Documents ![How to copy a folder and its contents in Terminal](https://iboysoft.com/images/en-news/copy-file-macos-terminal/how-to-copy-a-folder-and-its-content-in-terminal.jpg) Note: The R flag tells the cp command to copy everything inside the designated folder. ## How to copy multiple files from one directory to another in Terminal? To copy contents of one directory to another in Terminal rather than the directory itself: cp -R source\_directory/ destination\_directory\_path E.g., To copy files in the test folder on your desktop to the Documents folder: cp -R /Users/jenny/Desktop/test/ /Users/jenny/Documents (Notice the forward slash (/) used at the end of the source directory? This is the key to copying only contents, not the directory.) ![How to copy contents of one directory to another in Terminal](https://iboysoft.com/images/en-news/copy-file-macos-terminal/copy-contents-of-one-directory-to-another-in-terminal.jpg) To copy a specific file type to another directory in Terminal: cp \*.file\_type destination\_directory\_path E.g., To copy all txt files to your desktop: cp \*.txt /Users/jenny/Desktop/ To copy selected files to another directory in Terminal: cp file\_path1 file\_path2 destination\_directory\_path E.g., To copy 2 files from the test folder on your desktop to the Documents folder: cp /Users/jenny/Desktop/test/picture1.png /Users/jenny/Desktop/test/picture2.png /Users/jenny/Documents ![How to copy multiple files in Mac Terminal](https://iboysoft.com/images/en-news/copy-file-macos-terminal/copy-multiple-files-to-another-directory-in-terminal.jpg) To bash copy all files in directories and subdirectories: cp -R folder\_path1 folder\_path2 destination\_directory\_path E.g., To bash copy all files in the test1 and test2 folders on your desktop to the Documents folder: cp -R /Users/jenny/Desktop/test1 /Users/jenny/Desktop/test2 /Users/jenny/Documents ![how to bash copy all files in directories and subdirectories](https://iboysoft.com/images/en-news/copy-file-macos-terminal/bash-copy-all-files-in-directories-and-subdirectories.jpg) Tips: The Mac Terminal commands used above can also be used to copy files to an external hard drive on Mac. Share this post to help others copy files in macOS Terminal\! To copy a specific hidden file: cp hidden\_file\_path destination\_directory\_path E.g., To copy a hidden file named .config to the backup folder on your desktop: cp /Users/jenny/.config /Users/jenny/Desktop/backup/ To copy all files including hidden ones, from one directory to another: cp -R source\_directory\_path/{.\*,\*} destination\_directory\_path E.g., To copy all files, including hidden items from the test folder to the backup folder: cp -R /Users/jenny/Desktop/test/{.\*,\*} /Users/jenny/Desktop/backup/ ## macOS script to copy files on Mac with the cp command If you're looking to create a script on macOS to copy files using the cp command, take the following steps: 1. Open Terminal. 2. Create a script with a text editor like Nano. (for instance, copy\_files.sh)nano copy\_files.sh 3. Copy and paste the following script into the file. (Ensure you replace the source\_directory\_path and destination\_directory\_path.) ![The macOS script to copy files on Mac with the cp command](https://iboysoft.com/images/en-news/copy-file-macos-terminal/macos-script-to-copy-files-on-mac-with-the-cp-command.jpg) 4. Press Ctrl + o to write the changes, then press Enter, and then Ctrl + X to exit. 5. Give the script execution permissions.chmod +x copy\_files.sh 6. Now you can run the script../copy\_files.sh ![How to run the macOS Script to copy files in Terminal](https://iboysoft.com/images/en-news/copy-file-macos-terminal/run-macos-script-to-copy-files-in-terminal.jpg) If you find this post helpful, share it to benefit others who want to learn how to copy files or directories in Mac Terminal. Also Read: [How to Rename a File or Multiple Files in macOS Terminal?](https://iboysoft.com/tips/rename-file-macos-terminal.html)
Shard123 (laksa)
Root Hash1274133373948077523
Unparsed URLcom,iboysoft!/tips/copy-file-macos-terminal.html s443