Removing .DS_Store files from mac folders

Ben Cartwright bencvt at gmail.com
Wed Mar 1 21:38:53 EST 2006


David Pratt wrote:
> # Clean mac .DS_Store
>      if current_file == '.DS_Store':
>          print 'a DS_Store item encountered'
> 	os.remove(f)
...
> I can't figure why
> remove is not removing.


It looks like your indentation is off.  From what you posted, the
"print" line is prepended with 9 spaces, while the "os.remove" line is
prepended with a single tab.  Don't mix tabs and spaces.

Also, shouldn't that be "os.remove(current_file)"?

--Ben




More information about the Python-list mailing list