Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Im stuck with a problem that occured when attempting to copy a large directory which got interupted half way.
some of the files are in mp3/mp3/artist
others are located in mp3/artist
some are duplicated but I cant be sure all are in either directory but I do know one is larger than another.
I would like to merge the two directories overwriting is fine as long as it is the same file. When I try now the only option I get is to overwrite the whole artist directory which could be bad if the overwitten dir has files the other does not.
Well, if you were using a basic copy eg
/mp3/artist> cp * /mp3/mp3/artist
and it got interrupted, it just means that some files didn't make it to the target dir.
Just run the cmd again and it'll cp them all from scratch.
Before you start make sure you've 'fixed' whatever caused the original drop-out.
If you've changed some files in the tgt dir since the aborted cp and don't want to lose the changes, you can use the find cmd with the -mtime option to put them somewhere else first.
cp (or mv ) can only operate on files that exist in src dir, so you can't overwrite files in the tgt dir that you don't have in the src dir...
I'm not entirely clear on your 1st post there...
The 2 cmds operate at the file level, not dir level, as as a dir is a file in Linux, if you 'mv' a dir, all it does is change it's name.
If you worried about some kind of recursion effect, create a new temp dir, cp (not mv) all the files you want preserved into the temp dir, then sort out your final tgt dir structure/names and cp all the files into it.
Unless renaming a file or dir, i'd advise always use cp for multiple file 'moves' just in case of accidents (unless space is a real prob).
. . . if you 'mv' a dir, all it does is change it's name.
Well, usually. If the mv is taking place between file systems, i.e. drives or partitions, then mv does a copy followed by an erase. If you are in this situation & the data is important, then it's better to do the steps manually: a cp, a verify (e.g. diff or cmp loop), & only then an rm.