1. 如何取得文件名的創建時間,修改時間,大小
1
找到要查看的文件,右鍵點擊屬性
2
在彈出的對話框中,我們明顯可以看到有更詳細的信息,有文件的類型,位置,大小,佔用電腦空間,創建日期,修改日期等等,如下圖
3
當然我們如果只查看文件的大小和修改日期還有更簡潔的方法,左鍵點擊文件不動,會彈出一個對話框,顯示文件的大小和修改日期
2. 如何用批處理文件來備份文件名包含指定字元和文件的修改日期和時間在指定的范圍的文件到指定的路徑
建議你學學au3 寫個au3腳本 範例給你看看吧吧
;au3 源代碼文件1.au3
#include <file.au3>
$ini_file = @ScriptDir & "\1.ini"
$src_folder = IniRead($ini_file, "folder", "src", "D:\Test")
$tag_folder = IniRead($ini_file, "folder", "tag", "D:\Backup")
$start_date = IniRead($ini_file, "date", "start", "20111001")
$end_date = IniRead($ini_file, "date", "end", "20111001")
$start_time = IniRead($ini_file, "time", "start", "0300")
$endtime = IniRead($ini_file, "time", "end", "0305")
$file = _FileListToArray($src_folder, "*stock*.rpt", 1)
$modify_time = $file
For $i = 1 To $file[0]
$modify_time[$i] = StringLeft(FileGetTime($src_folder & "\" & $file[$i], 0, 1), 12)
$date = StringLeft($modify_time[$i], 8)
$time = StringRight($modify_time[$i], 4)
$date_in_range = StringCompare($date,$start_date)>=0 And StringCompare($date,$end_date)<=0
$time_in_range = StringCompare($time,$start_time)>=0 And StringCompare($time,$end_time)<=0
If $date_in_range And $time_in_range Then
FileCopy($src_folder & "\" & $file[$i], $tag_folder)
EndIf
Next
;配置文件1.ini
[folder]
src=D:\Test
tag=D:\Backup
[date]
start=20111001
end=20111001
[time]
start=0300
end=0305