OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add move files
Oliver Günther16e5f99a12af
diff --git a/help/move_files.rb b/help/move_files.rbnew file mode 100755index 00000000000..46e24ba7001--- /dev/null+++ b/help/move_files.rb@@ -0,0 +1,37 @@+#!/usr/bin/env ruby++require 'fileutils'++Dir.glob('**/*.md').each do |source_file|+ folder = File.dirname(source_file)+ filename = File.basename(source_file, '.md')++ next if filename == 'README'++ target_folder = File.join(folder, filename)+ target = File.join(target_folder, 'README.md')++ FileUtils.mkdir_p target_folder+ FileUtils.mv source_file, target+end++FileUtils.mkdir_p('unused-images')+Dir.glob('**/*.{png,jpg}').each do |image_file|+ image_filename = File.basename(image_file)+ contained = `rg -l '#{image_filename}'`.lines.map(&:chomp)++ if contained.empty?+ FileUtils.mv image_file, 'unused-images'+ elsif contained.length > 1+ warn "Skipping #{image_file} as used in more than one: #{contained.join(", ")}"+ else+ target_folder = File.dirname contained.first+ target_file = File.join(target_folder, image_filename)++ if image_file == target_file+ puts "Image is already at #{target_file}"+ else+ FileUtils.mv image_file, target_folder+ end+ end+end