我使用2个脚本按文件夹内的年份torrent文件重新排序,但每个脚本都不完整,因为我必须使用它们来移动它们。
例如
第一个脚本
@Echo Off
For %%a In (*19???.torrent *20???.torrent) Do Call :Sub "%%~a"
Exit/B
:Sub
Set "mfn=%~n1"
Set "lfc=%mfn:~-5%
Set "lfc=%lfc:(= %"
Set "lfc=%lfc:)= %"
Set "lfc=%lfc: =%"
If Not Exist "%lfc%\" MD %lfc%
Move %1 %lfc%
不要移动文件(文件扩展名为.torrent)
Animali Pazzi (1939) Toto
Anno 2000 La Corsa Della Morte
American History X 1998 1080p ENG
Devil 2010_001
第二个脚本
@Echo Off
For /F "Tokens=*" %%a In (
'Dir/B/A-D *.torrent^|Findstr/R "\<19[0-9][0-9]\> \<20[0-1][0-9]\>"') Do (
For %%b In (%%~na) Do Call :Sub "%%a" "%%b")
Pause
Exit/B
:Sub
Set "mfn=%~2"
Set "mfn=%mfn:(=%"
If %mfn:)=% GEq 1900 (If %mfn:)=% Lss 2017 (If Not Exist "%mfn:)=%\" MD %mfn:)=%
Move %1 %mfn:)=%))
但不要移动文件,如
Alla 39 Eclisse - The Awakening 1980_001
Predators 2010_002
Sono il Numero Quattro.2011_001
Abbronzatissimi.1991.avi
Continuavano a chiamarlo trinita1971 x264
32.Dicembre.1988.avi
我想要两个脚本的FUSION来解决这个动人的问题。
答案 0 :(得分:1)
我建议使用不同的脚本方法,例如powershell:
$ToFolder = "$env:USERPROFILE\Desktop\to"
$FromFolder = "$env:USERPROFILE\Desktop\From"
#Create the sample folder on your desktop
#This line can be commented out if your ToFolder exists
New-Item $ToFolder -ItemType directory -Force
GCI -Path $FromFolder *.torrent | % {
if ($_.Name -match "(19|20)\d{2}") {
#Check to see if year folder already exists at the destination
#If not then create a folder based on this year
if (!(Test-Path "$ToFolder\$($Matches[0])")) {
New-Item -Path "$ToFolder\$($Matches[0])" -ItemType directory
}
#Transfer the matching file to its new folder
#Can be changed to Move-Item if happy with the results
Copy-Item -Path $_.FullName -Destination "$ToFolder\$($Matches[0])" -Force
}
}