filenames.txt包含要在给定目录中更改的所有文件的名称。它是由以下方面产生的:
import os
walk = os.walk("./app/")
for dirpath, dirs, files in walk:
for filename in files:
fpath = os.path.join(dirpath, filename)
with open("filenames.txt", "a") as f:
f.write(filename + "\n&
当前档案名称:
Empty_test-one.txt,Empty_test-two.txt,Empty_test-three.txt
我只想重命名单词空。到目前为止我的代码是:
puts "Indicate new name of files":
new_name = gets.chomp
# Look for the specific files
Dir.glob("*.txt").each do |renaming|
# Renaming of files starts, but not on every file
File.rename(ren