I want to back-up all files from my laptop partitions to external HDD.
I ran, for example
cp -a /med*/ravb*/*00 /med*/ravb*/M*L*/7.3GB_CP && echo "7.3GB BACKED UP PROPERLY" || echo "7.3GB FAILED TO BACK UP"
The issue is that dot files are also getting included which I don’t want.
What should I do so as to ignore all dot files for backing up.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Why not use rsync instead? It’s made for the job!
rsync -uan --progress --exclude=".*" <source> <destination>
The above will list all the files to be archived without actually copying anything. Check that the list is correct, then run it again with the n option removed in order to copy the files (you could also remove the --progress for a quieter experience).
To expand, the options above are:-
u – ‘update’ – only copy newer files.
a – ‘archive’
n – ‘dry-run` – don’t copy, just list what it would do.
--progress – show progress of copy
--exclude=".*" – exclude files that begin with a dot
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0