Posts Tagged ‘rm’

Remove missing files from svn (forget)

Saturday, December 14th, 2013

I often forget to delete files under version control using the svn rm command. Then I still need to issue that command but auto-complete won’t help me out. I use this snippet to delete any missing (already deleted) files.

svn rm `svn st | sed -n "s/^\! *//p"`

Too many items on Desktop causes Finder to crawl

Monday, December 3rd, 2012

Recently Finder was crawlingly slow on my Mac. I had the spinning beach ball all the time and it even seem to affect the rest of my computer: mouse not responding etc. Finally I figured out that it was because I had too many items on my desktop. I had been outputting screen shots to the desktop and must have amassed some 10 thousand png files. So many that when I issued:

rm ~/Desktop/*.png

I got an error:

-bash: /bin/rm: Argument list too long

After finally deleting these files, Finder and my computer returned to normal.

Turn off rm, mv interactive prompting when ssh-ed into

Wednesday, December 16th, 2009

When I ssh into and issue a rm or mv command I am bombarded with prompts for every file. For example if I issue:

rm *.pdf

I have to type yes <ENTER> for every pdf in the current directory.

I have tried the -f option listed in the rm man page, but I’m still prompted. I wondered if there was a way to turn this prompting feature off. It would
be very convenient if rm-ing and mv-ing acted the same way in as the other unix and linux machines I used, use and will use.

I emailed the Courant help desk and got a solution:

That’s because in the system-wide .bashrc, the mv, cp, and rm commands are aliased to “mv -i”, “cp -i”, and “rm -i”. To unalias these commands in your environment, you just need to add the following lines to the end of your ~/.bashrc.

unalias rm
unalias mv

I did just that and now everything works fine.

Find and delete all .DS_Store files recursively

Friday, November 6th, 2009

This is posted all over the web, but sanity’s sake I’ll post it again here. This use of the unix command line program find will locate and remove all the .DS_Store files that Finder populates throughout your directories. The following removes all files by the name .DS_Store in the current directory recursively:

find . "-name" ".DS_Store" -exec rm {} \;