Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to backup my Eclipse .metadata directory. The command I run is:

cp -Rf ~/some/where/.metadata/* ~/some/backup/.metadata/.

The first time I tried this, the copy skipped the lock file and the .plugins and .mylyn directories. After doing some research, I found some threads mentioning permission changes. I applied the changes and found some success.

Now, running the script will not create or traverse into the .plugins or .mylyn directories. Additional research has come up with zero results.

I am using:

Windows XP SP 3

Cygwin 1.7.1-1

share|improve this question

migrated from stackoverflow.com Jan 14 '10 at 17:56

This question came from our site for professional and enthusiast programmers.

add comment

2 Answers

The wildcard character * in ~/some/where/.metadata/* does not match files or directories that begin with a dot. This is the behavior of most shells, not just Cygwin. Some alternatives:

  • Use another argument to explictly include dot files
    cp -Rf ~/some/where/.metadata/* ~/some/where/.metadata/.* ~/some/backup/.metadata/.

(.* does match files and directories that begin with two or more dots)

  • Use an expression that doesn't use the wildcard:
    cp -Rf ~/some/where/.metadata/ ~/some/backup/
  • Use the tar cf - | tar xf - idiom
    tar cf - ~/some/where/.metadata | (cd ~/some/backup/.metadata ; tar xf -)
share|improve this answer
add comment

I prefer using rsync or cpio to copy directories:

rsync -acv --delete . DST

find . | cpio -pudvm DST

I suspect I'm one of the few people to use cpio; it's an old habit from working on SysV machines. It has the drawback that you have to copy from the current directory: if you pass an absolute path to find, that path will be replicated in the destination directory. On the other hand rsync has its own weirdness depending on whether the SRC directory has a trailing slash.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.