Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Just recently I tried out a backup utility, and wanted to back up the local copies I have of some websites on my MacBook (OS X)

Unfortunately, the utility left two files in every directory it backed up: .shadowFileList and .shadowFolderFlagPlist

I have now removed the backup from that directory, but it still left the files and I would very much like to get rid of the dotfiles.

I am not really a command line power user, but know that's the best way to do it. I suspect I would have to pipe the output of find to rm.

How do you do this?

share|improve this question
up vote 20 down vote accepted
% find UPMOST_RELEVANT_PATH -name ".shadowFileList" -delete

obviously, do the same for any other filename you want to throw away...

share|improve this answer
    
I need it the other way around. I need to delete all files not of a certain file ending. How? Folders should not be deleted. – Jonny Oct 18 '15 at 17:03
    
find . ! -name "*.xyz" -delete, see also stackoverflow.com/questions/25136041/… – akira Oct 18 '15 at 17:37
    
I ended up with find . -type f -not -name "*.hpp" -not -name "*.h" -not -name "*.inl" -delete to keep folders. – Jonny Oct 18 '15 at 17:43

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.