I am trying to copy a filesystem for a device I am programming for. After so much time trying to figure out why the filesystem I was installing wasn't working I found out that cp
didn't get the job done. I used du -s
to check the size of the original filesystem and the one that I copied with cp -r
, as it turns out they differ by about 150 bytes.
Something is telling me that symbolic links or some sort of kernel objects aren't being copied correctly.
Is it possible to copy a folder/file system exactly? If so how would I go about it?
Open your folder, and select all the files ( Control + a or Command + a). Right-click and select Make a copy. That will create a new copy of each of those files, right in the same folder, with Copy of before their original file name.
Copy an Entire Folder in Google Drive Open the folder on Google Drive that you want to copy. Select the first file, hold down the Shift key on your keyboard and select the last file. This will select all files in the folder. Right-click inside the highlighted area and select Make a copy.
Right-click and pick Copy, or press Ctrl + C . Navigate to another folder, where you want to put the copy of the file. Click the menu button and pick Paste to finish copying the file, or press Ctrl + V . There will now be a copy of the file in the original folder and the other folder.
Hold down the Ctrl key on your keyboard and select any files and folders you want to copy. Release the key when you're done. All highlighted files and folders will be copied. Choose Edit and then Copy To Folder from the menu at the top of the folder's window.
Try doing this the straightforward way :
cp -a src target
from man cp
-a, --archive same as -dR --preserve=all
It preserve rights, symlinks...
Here I tried all the code in my Linux. Seems Rsync proposed by @seanmcl as the right one while others failed to keep owners and/or some special files or a denied result. The exact code is:
$ sudo rsync -aczvAXHS --progress /var/www/html /var/www/backup
Just remember to use just the directory name and not put a slash (/
) or a wildcard (/*
) at the end of source and target name otherwise the hidden files right below the source are not copied.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With