#!/usr/bin/perl ## Windows cleanup script.. ## For use after copying files from a Win partition to a *nix partition. $pwd = `pwd`; $crap = `find . | grep AlbumArt`; $crap .= `find . | grep desktop.ini`; $crap .= `find . | grep Folder.jpg`; $crap .= `find . | grep Thumbs.db`; $crap .= `find . | grep ehthumbs_vista.db`; # Vista @crap = split("\n",$crap); print "*** Scanning for Windows-only files (desktop.ini, Thumbs.db, ect)\n"; foreach $file (@crap) { print "Deleting ".$file."...\n"; unlink($file); } $files = `find $pwd`; @files = split("\n",$files); print "*** Fixing mode permissions\n"; foreach $file (@files) { if (-d $file || $file =~ m/\.cgi/ || $file =~ m/\.sh/ || $file =~ m/\.exe/) { print "Setting mode 755 on $file...\n"; chmod oct(755), $file; } else { print "Setting mode 644 on $file...\n"; chmod oct(644), $file; } } print "*** Done. You may want to pipe this through more or less to verify files are chmod'd to your liking.\n";