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!
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a very simple question and **yet** searching in the internet the responses are many and some even don't work at all.
The question is:
How do I copy an entire file tree, meaning, the folder, its subfolders, all files contained in them and all links, in other words everything from one place to another??
simple answers like "use cp -r" apparently do not work..
Thanks a thousand for your answers
Kansai
P.S> The question finished above,Just some background in case you want to know. I am developing using the source code of the kernel and userland. So far no problems. I put it somewhere, configure it, make my changes , make it and there I have solution A. But lets say I want solution B over solution A. ( I dont want to lose A) so my idea is to copy ALL the files I have been working on on another place and start on B there. I tried cp -r and it apparently copied all but when I tried to rebuild it showed errors, files not found etc. So instead of copy I downloaded again the source code , made all my changes in solution A and then solution B and it built. But I cant be doing this forever!
there must be some way to copy all my previous work some other place. Thanks a lot
Last edited by KansaiRobot; 11-04-2014 at 12:12 AM.
This where version management tools (like git or subversion) come in.
With git you just start a new branch for your modifications. So you would create a branch modA and a branch modB. After that you can easily switch between the two branches.
what do you mean by "do not work"? If you can answer that we can probably tell you how to achieve what you want. Tools that spring to mind include tar and rsync.
However since you are working with source code, and in particular the Linux kernel, I strongly suggest you use git.
what do you mean by "do not work"? If you can answer that we can probably tell you how to achieve what you want. Tools that spring to mind include tar and rsync.
However since you are working with source code, and in particular the Linux kernel, I strongly suggest you use git.
Evo2.
Well, as I explained previously I used cp -r and I apparently got the whole thing copied. But when I tried to build it some files were not found apparently. I imagine that some necessary links were not copied adequately and that generates the error since when I untar the original it worked without problem.
Well, as I explained previously I used cp -r and I apparently got the whole thing copied. But when I tried to build it some files were not found apparently. I imagine that some necessary links were not copied adequately and that generates the error since when I untar the original it worked without problem.
Links can preserved using the appropriate options with cp. For example use "cp -a". Same is true with tar and rsync. However, I sill think you should investigate using git.
Asking what tool is the best is asking for a flamewar to start.
Personally i use gitk (should come with git itself), which is a viewer to look at the latest changes.
Another simple tool is git-gui (should also come with git) to do basic maintenance on a git repo.
Besides that, several ide's have git support build-in. Look here and here for some more info.
I have already practiced some about Git. The commands, stuff. Now, I know that for example for a programming project in C you stage the source files (.c and .h) and pretty much ignore anything generated (.o, etc) So far for theory I understand.
Now I want to apply this to my real problem. Which is I downloaded the kernel and the userland source files (linux). I am going to use menuconfig to set some options and then build this into some image files to burn into my device.
Now the question is, which files should I stage?? or should I just stage the whole two directories that I downloaded (kernel and userland)
I realize that once I make the image files a lot of object files are going to be generated
Thank you for your help
Last edited by KansaiRobot; 12-15-2014 at 11:23 PM.
The staging area is for changes you want to commit to the repository, so if you make changes to a file, then stage it and commit. After committing, if you need to move back to the state before the commit, you can do so (take a look at git reset).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.