脚本系列
windows从windows系列
//shell-从1开始重命名文件
# 定义文件夹路径
$folderPath = "D:\灵燕云空间\灵燕空间\灵燕课堂\webapi\LingYanSpace\LingYanSpace.Domain\UnauthorizedFolderHost\SysUserStaticResource"
# 获取文件夹中的所有文件
$files = Get-ChildItem -Path $folderPath -File
# 初始化计数器
$counter = 1
# 遍历每个文件并重命名
foreach ($file in $files) {
# 构建新的文件名
$newFileName = "$counter.jpg"
$newFilePath = Join-Path -Path $folderPath -ChildPath $newFileName
# 重命名文件
Rename-Item -Path $file.FullName -NewName $newFileName
# 增加计数器
$counter++
}
linux系列
//文件名排序
ls -l | awk '{print $9}' | sort -k1.1nr