我有一个python程序,可以从文件名中删除字符串,但我正在寻找使用java的帮助。如何使用java重命名文件
与此类似
import glob,os
from tkinter import filedialog
import re
#in_path = filedialog.askdirectory() # if want to ask for directory
os.chdir(os.path.join("G:\\")) #change to os.chdir(os.path.join(in_path)) to used selected dir
for files in glob.glob("*.mp4"): #get mp4 files
filename = os.path.splitext(files)
ext=filename[-1]
thefile = filename[0]
if "v" in thefile: #if there is version, check where the letter "v" is
ind = thefile.index("v")
change = thefile[:ind].replace(".","").replace("_","")+thefile [ind:].replace("_","")+ext
else:
change = thefile.replace(".","")+ext
os.rename(files,change)
我们理解你,但你应该向我们提出一些Java代码,而不是蟒蛇 –
也许你可以试试[varycode(https://www.varycode.com/) –