This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# 将用三个空格缩进的变成四个空格缩进 | |
file_name = ARGV[0] | |
lines = File.read(file_name) | |
lines.split("\n").each do |line| | |
sp_count = 0 | |
while line[count] == " " do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/ruby | |
require 'colorize' | |
require 'optparse' | |
class FileStatus | |
attr_accessor :file_name, :status | |
def initialize(file_name, status) | |
@file_name = file_name | |
@status = status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
file_name_pattern = re.compile("^(.*)\\s\\(\\d\\)(\\..*)$") | |
for file_name in os.listdir("."): | |
matcher = file_name_pattern.match(file_name) | |
if matcher is not None: | |
new_file_name = matcher.group(1) + matcher.group(2) | |
os.rename(file_name, new_file_name) |