Skip to content

Instantly share code, notes, and snippets.

@nycdavid
Last active June 10, 2016 16:22
Show Gist options
  • Select an option

  • Save nycdavid/423312c79f7530401ccd to your computer and use it in GitHub Desktop.

Select an option

Save nycdavid/423312c79f7530401ccd to your computer and use it in GitHub Desktop.

Revisions

  1. David ko revised this gist Mar 16, 2016. 1 changed file with 6 additions and 2 deletions.
    8 changes: 6 additions & 2 deletions avid_mover.rb
    Original file line number Diff line number Diff line change
    @@ -13,8 +13,12 @@ def move_bins
    source = name
    split_name = name.split("/").last.split("-")
    bin = Bin.new(split_name[0], split_name[1], split_name[2])
    dest = "#{@project_path}#{bin.type}/#{bin.genre}/#{bin.filename}"
    dest_path = "#{@project_path}#{bin.type}/#{bin.genre}/"
    dest = "#{dest_path}#{bin.filename}"
    begin
    unless Dir.exist? dest_path
    FileUtils.mkdir_p dest_path
    end
    FileUtils.mv source, dest
    puts "Moving to #{dest}"
    rescue
    @@ -23,4 +27,4 @@ def move_bins
    end
    end
    end
    end
    end
  2. Jingle Media revised this gist Dec 9, 2015. 1 changed file with 26 additions and 1 deletion.
    27 changes: 26 additions & 1 deletion avid_mover.rb
    Original file line number Diff line number Diff line change
    @@ -1 +1,26 @@
    #
    require "fileutils"

    class AvidMover
    Bin = Struct.new(:type, :genre, :filename)

    def initialize(project_path)
    @project_path = project_path
    end

    def move_bins
    @bin_names = Dir.glob("#{@project_path}*.avb")
    @bin_names.each do |name|
    source = name
    split_name = name.split("/").last.split("-")
    bin = Bin.new(split_name[0], split_name[1], split_name[2])
    dest = "#{@project_path}#{bin.type}/#{bin.genre}/#{bin.filename}"
    begin
    FileUtils.mv source, dest
    puts "Moving to #{dest}"
    rescue
    puts "Can't move to #{dest}"
    next
    end
    end
    end
    end
  3. David Ko created this gist Dec 9, 2015.
    1 change: 1 addition & 0 deletions avid_mover.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    #