Monday, March 15, 2010

Taking a backup of a folder in Fedora Linux

Normal "cp" command will exclude files/folders starting with ".". Below steps are needed to make sure everything is copied (essentially a backup) of a given folder.

1. Set shopt dotglob option to enable.
shopt -s dotglob

2. Copy hidden files and folder.
cp -pr sourceDir destDir

3. Set shopt dotglob option to disable.
shopt -u dotglob

Reference

No comments: