Monday, September 3, 2007

How to delete useless Windows Files in Ubuntu Linux

After using Windows for a long time, my music and photos folder where filled with 'desktop.ini' and 'Thumbs.db' files. For a while I've been only using Ubuntu Linux, so I decided to delete those files.
To do it, you may use this command (have in mind that this goes throughout every sub folder in the selected path, so don't do it on the root folder):

find /my_path -type f -name "desktop.ini" -exec rm -f {} \;
find /my_path -type f -name "Thumbs.db" -exec rm -f {} \;
We may also use this command to delete album covers in our music folders:
find /music_path -type f -name "*.jpg" -exec rm -f {} \;
As you see, this can be used to delete any file (or type of file) recursively in folders. You may use it to delete other files, as long as you take care not to delete files you need or want.
If you want to examine the files that are going to be deleted before doing it, you should execute the same command, changing 'rm' for 'ls', like this:
find /my_path -type f -name "desktop.ini" -exec ls -f {} \;
In this way you may control the list of files to delete.
I hope this helps.

Cheers!

Technorati tags: , ,
Versión en español

6 comments:

Reece said...

I just used this nice one liner and FSlint to completely clean up my photo archive. Thanks for the tip.

Sebastián Stucke said...

I'll take a look at FSlint, sounds cool :)
Thank you Reece.

Anonymous said...

or you could use the even shorter version:
find Music/ -type f -name "Thumbs.db" -delete
or
find Music/ -type f -name "Thumbs.db" -ls

Anonymous said...

In fish shell, you need to put '{}' \; at the end or it doesn't work. I like anonymous's method better, though.

Jack Chrysler said...

http://www.krojamsoft.com/filecleaner.php

Anonymous said...

For Windows users:

del /s Thumbs.db