Skip to content

Instantly share code, notes, and snippets.

@aont
Created November 18, 2010 01:05
Show Gist options
  • Select an option

  • Save aont/704472 to your computer and use it in GitHub Desktop.

Select an option

Save aont/704472 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
DirPath = ARGV[0]
puts DirPath
Dir::chdir(DirPath)
dirs = Dir::glob("*/")
mp3files = Dir::glob("*.mp3¥0*.wma")
TempDir = ".tempdir/"
begin
Dir::mkdir(TempDir)
rescue
end
dirs.each do |f|
File::rename(f,TempDir+f)
end
dirs.sort.each do |f|
print "¥t"
puts f
File::rename(TempDir+f,f)
end
mp3files.each do |f|
File::rename(f,TempDir+f)
end
mp3files.sort.each do |f|
print "¥t"
puts f
File::rename(TempDir+f,f)
end
begin
Dir::rmdir(TempDir)
rescue
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment