Files
geedge-jira/attachment/10754/彭程rename.ps1
2025-09-14 22:00:20 +00:00

20 lines
748 B
PowerShell

$path="C:\Users\HASEE\Desktop\ps"
$file="^智"
ls $path
mkdir $path/备份
mkdir $path/修改
Copy-Item $path/*.html $path/备份/
#ls $path -Include $file -Recurse | ForEach-Object{Rename-Item $_.FullName$_.FullName.Replace('智联招聘','(Zhaopin)应聘-JAVA-软件工程师')}
ls $path -Recurse | ForEach-Object{Rename-Item $_.FullName$_.FullName.Replace('_','-')}
$a=Get-ChildItem $path *.html
foreach($i in $a)
{
$c=("$a" -split "-")[1]
$c
$d=("$a" -split "-")[4]
$d
$c="(Zhaoping.com)应聘","JAVA","软件工程师","$d","$c" -join("-") #拼接字符串
$c
#rename-item -newname { $_.name -replace '*.html','$c.html'}
ls $path/修改/ -Recurse | ForEach-Object{Rename-Item $_.FullName$_.FullName.Replace( '*.html','$c.html')} #重命名拷贝新文件到修改
}