•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 403,510 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,052 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 446 | Replies: 1 | Solved
![]() |
•
•
Join Date: Nov 2007
Posts: 108
Reputation:
Rep Power: 1
Solved Threads: 0
would anyone please tell me how i cp the whole directory to another directory without the originalDir name....
ex: say the original contains multiple directory contains multiple directory.. and files how do i copy everything from one directory to another directory
i tried cp -r /home/henry/originalDir /home/henry/newDirectory..... however my newDirectory contains the directory originalDir........
how do i copy everything from the originalDir to the newDir?
by the way, what is the difference between cp and hard link? thank you
ex: say the original contains multiple directory contains multiple directory.. and files how do i copy everything from one directory to another directory
i tried cp -r /home/henry/originalDir /home/henry/newDirectory..... however my newDirectory contains the directory originalDir........
how do i copy everything from the originalDir to the newDir?
by the way, what is the difference between cp and hard link? thank you
Perhaps
> by the way, what is the difference between cp and hard link?
A hard link isn't a copy of the file, but two directory entries pointing at the SAME part of the disk. Changing the file via one of them also changes the file as seen from the other link.
Also, to remove a file with say two hard links, you have to remove both directory entries.
It's a nice way of preventing accidental deletion, but it's no backup solution.
cp -r /home/henry/originalDir/* /home/henry/newDirectory
> by the way, what is the difference between cp and hard link?
A hard link isn't a copy of the file, but two directory entries pointing at the SAME part of the disk. Changing the file via one of them also changes the file as seen from the other link.
Also, to remove a file with say two hard links, you have to remove both directory entries.
It's a nice way of preventing accidental deletion, but it's no backup solution.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
Do not PM me for help; You'll be ignored, or told to learn to read.
Do not ask me if I'm muslim - I'm not. Nor do I care about yours or anyone else's mysticism. Religion is a matrix, take the RED PILL.
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Directory Creation problem (Shell Scripting)
- Script to delete or backup logs at a specific time and under specific user (Shell Scripting)
- creating a backup file (Shell Scripting)
- how to backup mysql DB to local machine? and restore? (MySQL)
- 100 manual directory submissions, in a month--too many? (Search Engine Optimization)
- NT 4.0 & Active directory authentication (Windows NT / 2000 / XP / 2003)
- [Software] Backup your Outlook (Windows NT / 2000 / XP / 2003)
- shell scripting help with backup script (Shell Scripting)
Other Threads in the Shell Scripting Forum
- Previous Thread: Example BASh assignments
- Next Thread: writing a script for nagios checks...



Linear Mode