Wednesday, November 21, 2007

Find and Delete Files

Need to find a pattern in a filename and delete all those files?

find . -name "ftp.log" -exec rm '{}' \;

You can replace "ftp.log" with "*.log" to get all files with the .log extension. The "." after find just means "search at the current directory".

I got this from this website: http://www.aota.net/forums/archive/index.php/t-20930.html

Wednesday, November 14, 2007

When moving from Windows to Linux

If you're a programmer, you need to move your text (ASCII) files properly from Windows to Linux or else you'll have more headaches than you should. I had that headache today so I'm posting this so you may not have to go through it.

I had some config files for gVim that had an extra "^M" character after every line. I think that's a return carriage in Windows.

To clean files automatically, put them in Subversion, or simpler yet, put it through an FTP server. Make sure though that you upload it as ASCII and the files aren't zipped. Apparently, that does the job!