My music collection is on my NAS and since my wife uses Windows, the only way to share files with her is on a samba share. Since she listens to music a lot with Windows Media Player, it ends putting a lot of unnecessary files into the music folders. Typically, it puts 3 different sizes of the same jpg in a folder, plus an .ini file. On a large music collection, that could end up being quite a large amount of crap files that I don't want in my music folder.
My solution is quite simple, but requires the command line.
You may or may not be familiar with the find command. I use it, along with another, rm, to remove all the waste files. The syntax of the combined commands is a little tricky though. It goes like this....
find . -regextype posix-awk -regex "(.*.jpg|.*.ini|.*.rtf|.*.url|.*.txt|.*.log|.*.sfv|.*.nfo|.*.md5|.*.m3u)" -exec rm {} \;
This tells it to recursively find everything starting from the current directory that has any of the above extensions, and delete it. These are all the BS file extensions people put in shared music folders that I don't want.
Now my music diriectory is de-bastardized and only contains music.
I run this command just before I sync my music directories on my desktop and server, so I'm not syncing a bunch of extra crap. Technically, rsync could handle that too, but I prefer to do it this way.
This could very easily be turned into a bash script and run daily with a cron job, which would completely automate the task. Once you know the commands, the command line can be a much quicker way to accomplish tasks.
1 comment:
Or you could make the share read-only, like i do.
Post a Comment