欧美成人精品手机在线观看_69视频国产_动漫精品第一页_日韩中文字幕网 - 日本欧美一区二区

LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發(fā)文檔 其他文檔  
 
網(wǎng)站管理員

ASP之FSO函數(shù)大全

admin
2010年7月22日 21:58 本文熱度 5557
[p]<[color=#0000ff]%[/color][br][color=#ff00ff]'asp中一些fso方面的函數(shù) [/color][br][br][br][color=#ff00ff]'//==================================文件操作================================== [/color][br][br][br][color=#ff00ff]'取文件大小 [/color][br][color=#0000a0][b]function[/b][/color] getfilesize[color=#0000ff]([/color]filename[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:取文件大小 [/color][br][color=#ff00ff]'//形參:文件名 [/color][br][color=#ff00ff]'//返回值:成功為文件大小,失敗為-1 [/color][br][color=#ff00ff]'// [/color][br]dim f [br]if reportfilestatus[color=#0000ff]([/color]filename[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]set f [color=#0000ff]=[/color] fso[color=#0000ff].[/color]getfile[color=#0000ff]([/color]filename[color=#0000ff])[/color] [br]getfilesize [color=#0000ff]=[/color] f[color=#0000ff].[/color]size [br]else [br]getfilesize [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'文件刪除 [/color][br][color=#0000a0][b]function[/b][/color] deleteafile[color=#0000ff]([/color]filespec[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:文件刪除 [/color][br][color=#ff00ff]'//形參:文件名 [/color][br][color=#ff00ff]'//返回值:成功為1,失敗為-1 [/color][br][color=#ff00ff]'// [/color][br]if reportfilestatus[color=#0000ff]([/color]filespec[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]fso[color=#0000ff].[/color]deletefile[color=#0000ff]([/color]filespec[color=#0000ff])[/color] [br]deleteafile [color=#0000ff]=[/color] 1 [br]else [br]deleteafile [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'顯示文件列表 [/color][br][color=#0000a0][b]function[/b][/color] showfilelist[color=#0000ff]([/color]folderspec[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:目錄存在時顯示此目錄下的所有文件 [/color][br][color=#ff00ff]'//形參:目錄名 [/color][br][color=#ff00ff]'//返回值:成功為文件列表,失敗為-1 [/color][br][color=#ff00ff]'// [/color][br]dim f[color=#0000ff],[/color] f1[color=#0000ff],[/color] fc[color=#0000ff],[/color] s [br]if reportfolderstatus[color=#0000ff]([/color]folderspec[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]set f [color=#0000ff]=[/color] fso[color=#0000ff].[/color]getfolder[color=#0000ff]([/color]folderspec[color=#0000ff])[/color] [br]set fc [color=#0000ff]=[/color] f[color=#0000ff].[/color]files [br]for each f1 [color=#800000][b]in[/b][/color] fc [br]s [color=#0000ff]=[/color] s [color=#0000ff]&[/color] f1[color=#0000ff].[/color]name [br]s [color=#0000ff]=[/color] s [color=#0000ff]&[/color] [color=#ff00ff]"|"[/color] [br]next [br]showfilelist [color=#0000ff]=[/color] s [br]else [br]showfilelist [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'!!! [/color][br][color=#ff00ff]'文件復(fù)制 [/color][br][color=#0000a0][b]function[/b][/color] copyafile[color=#0000ff]([/color]sourcefile[color=#0000ff],[/color]destinationfile[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:源文件存在時,才能對文件進(jìn)行復(fù)制,目的文件無影響 [/color][br][color=#ff00ff]'//形參:源文件,目的文件 [/color][br][color=#ff00ff]'//返回值:成功為1,失敗為-1 [/color][br][color=#ff00ff]'// [/color][br]dim myfile [br]if reportfilestatus[color=#0000ff]([/color]sourcefile[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]set myfile [color=#0000ff]=[/color] fso[color=#0000ff].[/color]getfile[color=#0000ff]([/color]sourcefile[color=#0000ff])[/color] [br]myfile[color=#0000ff].[/color]copy [color=#0000ff]([/color]destinationfile[color=#0000ff])[/color] [br]copyafile [color=#0000ff]=[/color] 1 [br]else [br]copyafile [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'文件移動 [/color][br][color=#ff00ff]'response.write moveafile("f:\123\4561.exe","f:\123\4562.txt") [/color][br][color=#0000a0][b]function[/b][/color] moveafile[color=#0000ff]([/color]sourcefile[color=#0000ff],[/color]destinationfile[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:源文件存在時目的文件不存在時才能對文件進(jìn)行移動 [/color][br][color=#ff00ff]'//形參:源文件,目的文件 [/color][br][color=#ff00ff]'//返回值:成功為1,失敗為-1 [/color][br][color=#ff00ff]'// [/color][br]if reportfilestatus[color=#0000ff]([/color]sourcefile[color=#0000ff])[/color][color=#0000ff]=[/color]1 and [br]reportfilestatus[color=#0000ff]([/color]destinationfileorpath[color=#0000ff])[/color] [color=#0000ff]=[/color] [br][br][br][color=#0000ff]-[/color]1 then [br]fso[color=#0000ff].[/color]movefile sourcefile[color=#0000ff],[/color]destinationfileorpath [br]moveafile [color=#0000ff]=[/color] 1 [br]else [br]moveafile [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'文件是否存在? [/color][br][color=#ff00ff]'response.write reportfilestatus("g:\soft\delphi\my_pro\代碼庫.exe") [/color][br][color=#0000a0][b]function[/b][/color] reportfilestatus[color=#0000ff]([/color]filename[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:判斷文件是否存在 [/color][br][color=#ff00ff]'//形參:文件名 [/color][br][color=#ff00ff]'//返回值:成功為1,失敗為-1 [/color][br][color=#ff00ff]'// [/color][br]dim msg [br]msg [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]if [color=#0000ff]([/color]fso[color=#0000ff].[/color]fileexists[color=#0000ff]([/color]filename[color=#0000ff])[/color][color=#0000ff])[/color] then [br]msg [color=#0000ff]=[/color] 1 [br]else [br]msg [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end if [br]reportfilestatus [color=#0000ff]=[/color] msg [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'文件創(chuàng)建日期 [/color][br][color=#ff00ff]'response.write showdatecreated("g:\soft\delphi\my_pro\代碼庫.exe") [/color][br][color=#ff00ff]'response.write showdatecreated("g:\soft\delphi\my_pro\復(fù)件 [/color][br]代碼庫[color=#0000ff].[/color]exe[color=#ff00ff]") [/color][br][color=#0000a0][b]function[/b][/color] showdatecreated[color=#0000ff]([/color]filespec[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:文件創(chuàng)建日期 [/color][br][color=#ff00ff]'//形參:文件名 [/color][br][color=#ff00ff]'//返回值:成功:文件創(chuàng)建日期,失?。?1 [/color][br][color=#ff00ff]'// [/color][br]dim f [br]if reportfilestatus[color=#0000ff]([/color]filespec[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]set f [color=#0000ff]=[/color] fso[color=#0000ff].[/color]getfile[color=#0000ff]([/color]filespec[color=#0000ff])[/color] [br]showdatecreated [color=#0000ff]=[/color] f[color=#0000ff].[/color]datecreated [br]else [br]showdatecreated [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'文件屬性 [/color][br][color=#ff00ff]'response.write getattributes("g:\soft\delphi\my_pro\復(fù)件 [/color][br]代碼庫[color=#0000ff].[/color]exe[color=#ff00ff]") [/color][br][color=#0000a0][b]function[/b][/color] getattributes[color=#0000ff]([/color]filename[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:顯示文件屬性 [/color][br][color=#ff00ff]'//形參:文件名 [/color][br][color=#ff00ff]'//返回值:成功:文件屬性,失?。?1 [/color][br][color=#ff00ff]'// [/color][br]dim f[color=#0000ff],[/color]str [br]if reportfilestatus[color=#0000ff]([/color]filename[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]set f [color=#0000ff]=[/color] fso[color=#0000ff].[/color]getfile[color=#0000ff]([/color]filename[color=#0000ff])[/color] [br]select case f[color=#0000ff].[/color][color=#008000]attributes[/color] [br]case 0 str[color=#0000ff]=[/color][color=#ff00ff]"普通文件。沒有設(shè)置任何屬性。 "[/color] [br]case 1 str[color=#0000ff]=[/color][color=#ff00ff]"只讀文件??勺x寫。 "[/color] [br]case 2 str[color=#0000ff]=[/color][color=#ff00ff]"隱藏文件。可讀寫。 "[/color] [br]case 4 str[color=#0000ff]=[/color][color=#ff00ff]"系統(tǒng)文件??勺x寫。 "[/color] [br]case 16 str[color=#0000ff]=[/color][color=#ff00ff]"文件夾或目錄。只讀。 "[/color] [br]case 32 str[color=#0000ff]=[/color][color=#ff00ff]"上次備份后已更改的文件??勺x寫。 "[/color] [br]case 1024 str[color=#0000ff]=[/color][color=#ff00ff]"鏈接或快捷方式。只讀。 "[/color] [br]case 2048 str[color=#0000ff]=[/color][color=#ff00ff]" 壓縮文件。只讀。"[/color] [br]end select [br]getattributes [color=#0000ff]=[/color] str [br]else [br]getattributes [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'最后一次訪問/最后一次修改時間 [/color][br][color=#ff00ff]'response.write showfileaccessinfo("g:\soft\delphi\my_pro\復(fù)件 [/color][br]代碼庫[color=#0000ff].[/color]exe[color=#ff00ff]") [/color][br][color=#0000a0][b]function[/b][/color] showfileaccessinfo[color=#0000ff]([/color]filename[color=#0000ff],[/color]infotype[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:顯示文件創(chuàng)建時信息 [/color][br][color=#ff00ff]'//形參:文件名,信息類別 [/color][br][color=#ff00ff]'// 1 -----創(chuàng)建時間 [/color][br][color=#ff00ff]'// 2 -----上次訪問時間 [/color][br][color=#ff00ff]'// 3 -----上次修改時間 [/color][br][color=#ff00ff]'// 4 -----文件路徑 [/color][br][color=#ff00ff]'// 5 -----文件名稱 [/color][br][color=#ff00ff]'// 6 -----文件類型 [/color][br][color=#ff00ff]'// 7 -----文件大小 [/color][br][color=#ff00ff]'// 8 -----父目錄 [/color][br][color=#ff00ff]'// 9 -----根目錄 [/color][br][color=#ff00ff]'//返回值:成功為文件創(chuàng)建時信息,失?。?1 [/color][br][color=#ff00ff]'// [/color][br]dim f[color=#0000ff],[/color] s [br]if reportfilestatus[color=#0000ff]([/color]filename[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]set f [color=#0000ff]=[/color] fso[color=#0000ff].[/color]getfile[color=#0000ff]([/color]filename[color=#0000ff])[/color] [br]select case infotype [br]case 1 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]datecreated [color=#ff00ff]'// 1 ----- [/color][br][br][br]創(chuàng)建時間 [br]case 2 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]datelastaccessed [color=#ff00ff]'// 2 -----上次訪問 [/color][br][br][br]時間 [br]case 3 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]datelastmodified [color=#ff00ff]'// 3 -----上次修改 [/color][br][br][br]時間 [br]case 4 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]path [color=#ff00ff]'// 4 [/color][br][br][br][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color]文件路徑 [br]case 5 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]name [color=#ff00ff]'// 5 [/color][br][br][br][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color]文件名稱 [br]case 6 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]type [color=#ff00ff]'// 6 [/color][br][br][br][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color]文件類型 [br]case 7 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]size [color=#ff00ff]'// 7 [/color][br][br][br][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color]文件大小 [br]case 8 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]parentfolder [color=#ff00ff]'// 8 ----- [/color][br][br][br]父目錄 [br]case 9 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]rootfolder [color=#ff00ff]'// 8 ----- [/color][br][br][br]根目錄 [br]end select [br]showfileaccessinfo [color=#0000ff]=[/color] s [br]else [br]showfileaccessinfo [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'寫文本文件 [/color][br][color=#0000a0][b]function[/b][/color] writetxtfile[color=#0000ff]([/color]filename[color=#0000ff],[/color]textstr[color=#0000ff],[/color]writeorappendtype[color=#0000ff])[/color] [br]const forreading [color=#0000ff]=[/color] 1[color=#0000ff],[/color] forwriting [color=#0000ff]=[/color] 2 [color=#0000ff],[/color] forappending [color=#0000ff]=[/color] 8 [br]dim f[color=#0000ff],[/color] m [br]select case writeorappendtype [br]case 1[color=#0000ff]:[/color] [color=#ff00ff]'文件進(jìn)行寫操作 [/color][br]set f [color=#0000ff]=[/color] fso[color=#0000ff].[/color]opentextfile[color=#0000ff]([/color]filename[color=#0000ff],[/color] forwriting[color=#0000ff],[/color] true[color=#0000ff])[/color] [br]f[color=#0000ff].[/color]write textstr [br]f[color=#0000ff].[/color]close [br]if reportfilestatus[color=#0000ff]([/color]filename[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]writetxtfile [color=#0000ff]=[/color] 1 [br]else [br]writetxtfile [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]case 2[color=#0000ff]:[/color] [color=#ff00ff]'文件末尾進(jìn)行寫操作 [/color][br]if reportfilestatus[color=#0000ff]([/color]filename[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]set f [color=#0000ff]=[/color] fso[color=#0000ff].[/color]opentextfile[color=#0000ff]([/color]filename[color=#0000ff],[/color] forappending[color=#0000ff])[/color] [br]f[color=#0000ff].[/color]write textstr [br]f[color=#0000ff].[/color]close [br]writetxtfile [color=#0000ff]=[/color] 1 [br]else [br]writetxtfile [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end select [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'讀文本文件 [/color][br][color=#0000a0][b]function[/b][/color] readtxtfile[color=#0000ff]([/color]filename[color=#0000ff])[/color] [br]const forreading [color=#0000ff]=[/color] 1[color=#0000ff],[/color] forwriting [color=#0000ff]=[/color] 2 [br]dim f[color=#0000ff],[/color] m [br]if reportfilestatus[color=#0000ff]([/color]filename[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]set f [color=#0000ff]=[/color] fso[color=#0000ff].[/color]opentextfile[color=#0000ff]([/color]filename[color=#0000ff],[/color] forreading[color=#0000ff])[/color] [br]m [color=#0000ff]=[/color] f[color=#0000ff].[/color]readline [br][color=#ff00ff]'m = f.readall [/color][br][color=#ff00ff]'f.skipline [/color][br]readtxtfile [color=#0000ff]=[/color] m [br]f[color=#0000ff].[/color]close [br]else [br]readtxtfile [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'建立文本文件 [/color][br][br][br][color=#ff00ff]'//==================================目錄操作================================== [/color][br][br][br][color=#ff00ff]'取目錄大小 [/color][br][color=#0000a0][b]function[/b][/color] getfoldersize[color=#0000ff]([/color]foldername[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:取目錄大小 [/color][br][color=#ff00ff]'//形參:目錄名 [/color][br][color=#ff00ff]'//返回值:成功為目錄大小,失敗為-1 [/color][br][color=#ff00ff]'// [/color][br]dim f [br]if reportfolderstatus[color=#0000ff]([/color]foldername[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]set f [color=#0000ff]=[/color] fso[color=#0000ff].[/color]getfolder[color=#0000ff]([/color]foldername[color=#0000ff])[/color] [br]getfoldersize [color=#0000ff]=[/color] f[color=#0000ff].[/color]size [br]else [br]getfoldersize [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'創(chuàng)建的文件夾 [/color][br][color=#0000a0][b]function[/b][/color] createfolderdemo[color=#0000ff]([/color]foldername[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:創(chuàng)建的文件夾 [/color][br][color=#ff00ff]'//形參:目錄名 [/color][br][color=#ff00ff]'//返回值:成功為1,失敗為-1 [/color][br][color=#ff00ff]'// [/color][br]dim f [br]if reportfolderstatus[color=#0000ff]([/color]foldername[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]createfolderdemo [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]else [br]set f [color=#0000ff]=[/color] fso[color=#0000ff].[/color]createfolder[color=#0000ff]([/color]foldername[color=#0000ff])[/color] [br]createfolderdemo [color=#0000ff]=[/color] 1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'!!! [/color][br][color=#ff00ff]'目錄刪除 [/color][br][color=#0000a0][b]function[/b][/color] deleteafolder[color=#0000ff]([/color]folderspec[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:目錄刪除 [/color][br][color=#ff00ff]'//形參:目錄名 [/color][br][color=#ff00ff]'//返回值:成功為1,失敗為-1 [/color][br][color=#ff00ff]'// [/color][br]response[color=#0000ff].[/color]write folderspec [br]if reportfolderstatus[color=#0000ff]([/color]folderspec[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]fso[color=#0000ff].[/color]deletefolder [color=#0000ff]([/color]folderspec[color=#0000ff])[/color] [br]deleteafolder [color=#0000ff]=[/color] 1 [br]else [br]deleteafolder [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'顯示目錄列表 [/color][br][color=#0000a0][b]function[/b][/color] showfolderlist[color=#0000ff]([/color]folderspec[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:目錄存在時顯示此目錄下的所有子目錄 [/color][br][color=#ff00ff]'//形參:目錄名 [/color][br][color=#ff00ff]'//返回值:成功為子目錄列表,失敗為-1 [/color][br][color=#ff00ff]'// [/color][br]dim f[color=#0000ff],[/color] f1[color=#0000ff],[/color] fc[color=#0000ff],[/color] s [br]if reportfolderstatus[color=#0000ff]([/color]folderspec[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]set f [color=#0000ff]=[/color] fso[color=#0000ff].[/color]getfolder[color=#0000ff]([/color]folderspec[color=#0000ff])[/color] [br]set fc [color=#0000ff]=[/color] f[color=#0000ff].[/color]subfolders [br]for each f1 [color=#800000][b]in[/b][/color] fc [br]s [color=#0000ff]=[/color] s [color=#0000ff]&[/color] f1[color=#0000ff].[/color]name [br]s [color=#0000ff]=[/color] s [color=#0000ff]&[/color] [color=#ff00ff]"|"[/color] [br]next [br]showfolderlist [color=#0000ff]=[/color] s [br]else [br]showfolderlist [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'!!!! [/color][br][color=#ff00ff]'目錄復(fù)制 [/color][br][color=#0000a0][b]function[/b][/color] copyafolder[color=#0000ff]([/color]sourcefolder[color=#0000ff],[/color]destinationfolder[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:源目錄存在時,才能對目錄進(jìn)行復(fù)制,目的目錄無影響 [/color][br][color=#ff00ff]'//形參:源目錄,目的目錄 [/color][br][color=#ff00ff]'//返回值:成功為1,失敗為-1 [/color][br][color=#ff00ff]'// [/color][br][color=#ff00ff]'dim myfolder [/color][br][color=#ff00ff]'if reportfolderstatus(sourcefolder) = 1 and reportfolderstatus [/color][br][br][br][color=#0000ff]([/color]destinationfolder[color=#0000ff])[/color] [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 then [br][color=#ff00ff]'set myfolder = fso.getfolder(sourcefolder) [/color][br]fso[color=#0000ff].[/color]copyfolder sourcefolder[color=#0000ff],[/color]destinationfolder [br]copyafolder [color=#0000ff]=[/color] 1 [br][color=#ff00ff]'else [/color][br]copyafolder [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br][color=#ff00ff]'end if [/color][br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'目錄進(jìn)行移動 [/color][br][color=#0000a0][b]function[/b][/color] moveafolder[color=#0000ff]([/color]sourcepath[color=#0000ff],[/color]destinationpath[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:源目錄存在時目的目錄不存在時才能對目錄進(jìn)行移動 [/color][br][color=#ff00ff]'//形參:源目錄,目的目錄 [/color][br][color=#ff00ff]'//返回值:成功為1,失敗為-1 [/color][br][color=#ff00ff]'// [/color][br]if reportfolderstatus[color=#0000ff]([/color]sourcepath[color=#0000ff])[/color][color=#0000ff]=[/color]1 and [br]reportfolderstatus[color=#0000ff]([/color]destinationpath[color=#0000ff])[/color][color=#0000ff]=[/color]0 [br][br][br]then [br]fso[color=#0000ff].[/color]movefolder sourcepath[color=#0000ff],[/color] destinationpath [br]moveafolder [color=#0000ff]=[/color] 1 [br]else [br]moveafolder [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'判斷目錄是否存在 [/color][br][color=#ff00ff]'response.write reportfolderstatus("g:\soft\delphi\my_pro\") [/color][br][color=#0000a0][b]function[/b][/color] reportfolderstatus[color=#0000ff]([/color]fldr[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:判斷目錄是否存在 [/color][br][color=#ff00ff]'//形參:目錄 [/color][br][color=#ff00ff]'//返回值:成功為1,失敗為-1 [/color][br][color=#ff00ff]'// [/color][br]dim msg [br]msg [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]if [color=#0000ff]([/color]fso[color=#0000ff].[/color]folderexists[color=#0000ff]([/color]fldr[color=#0000ff])[/color][color=#0000ff])[/color] then [br]msg [color=#0000ff]=[/color] 1 [br]else [br]msg [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end if [br]reportfolderstatus [color=#0000ff]=[/color] msg [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'目錄創(chuàng)建時信息 [/color][br][color=#0000a0][b]function[/b][/color] showfolderaccessinfo[color=#0000ff]([/color]foldername[color=#0000ff],[/color]infotype[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:顯示目錄創(chuàng)建時信息 [/color][br][color=#ff00ff]'//形參:目錄名,信息類別 [/color][br][color=#ff00ff]'// 1 -----創(chuàng)建時間 [/color][br][color=#ff00ff]'// 2 -----上次訪問時間 [/color][br][color=#ff00ff]'// 3 -----上次修改時間 [/color][br][color=#ff00ff]'// 4 -----目錄路徑 [/color][br][color=#ff00ff]'// 5 -----目錄名稱 [/color][br][color=#ff00ff]'// 6 -----目錄類型 [/color][br][color=#ff00ff]'// 7 -----目錄大小 [/color][br][color=#ff00ff]'// 8 -----父目錄 [/color][br][color=#ff00ff]'// 9 -----根目錄 [/color][br][color=#ff00ff]'//返回值:成功為目錄創(chuàng)建時信息,失?。?1 [/color][br][color=#ff00ff]'// [/color][br]dim f[color=#0000ff],[/color] s [br]if reportfolderstatus[color=#0000ff]([/color]foldername[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]set f [color=#0000ff]=[/color] fso[color=#0000ff].[/color]getfolder[color=#0000ff]([/color]foldername[color=#0000ff])[/color] [br]select case infotype [br]case 1 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]datecreated [color=#ff00ff]'// 1 ----- [/color][br][br][br]創(chuàng)建時間 [br]case 2 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]datelastaccessed [color=#ff00ff]'// 2 -----上次訪問 [/color][br][br][br]時間 [br]case 3 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]datelastmodified [color=#ff00ff]'// 3 -----上次修改 [/color][br][br][br]時間 [br]case 4 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]path [color=#ff00ff]'// 4 [/color][br][br][br][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color]文件路徑 [br]case 5 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]name [color=#ff00ff]'// 5 [/color][br][br][br][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color]文件名稱 [br]case 6 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]type [color=#ff00ff]'// 6 [/color][br][br][br][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color]文件類型 [br]case 7 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]size [color=#ff00ff]'// 7 [/color][br][br][br][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color][color=#0000ff]-[/color]文件大小 [br]case 8 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]parentfolder [color=#ff00ff]'// 8 ----- [/color][br][br][br]父目錄 [br]case 9 s [color=#0000ff]=[/color] f[color=#0000ff].[/color]rootfolder [color=#ff00ff]'// 9 ----- [/color][br][br][br]根目錄 [br]end select [br]showfolderaccessinfo [color=#0000ff]=[/color] s [br]else [br]showfolderaccessinfo [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#0000a0][b]function[/b][/color] displayleveldepth[color=#0000ff]([/color]pathspec[color=#0000ff])[/color] [br]dim f[color=#0000ff],[/color] n [color=#0000ff],[/color]path [br]set f [color=#0000ff]=[/color] fso[color=#0000ff].[/color]getfolder[color=#0000ff]([/color]pathspec[color=#0000ff])[/color] [br]if f[color=#0000ff].[/color]isrootfolder then [br]displayleveldepth [color=#0000ff]=[/color][color=#ff00ff]"指定的文件夾是根文件夾。"[/color][color=#0000ff]&[/color]rootfolder [br]else [br]do until f[color=#0000ff].[/color]isrootfolder [br]path [color=#0000ff]=[/color] path [color=#0000ff]&[/color] f[color=#0000ff].[/color]name [color=#0000ff]&[/color][color=#ff00ff]"
"[/color] [br]set f [color=#0000ff]=[/color] f[color=#0000ff].[/color]parentfolder [br]n [color=#0000ff]=[/color] n [color=#0000ff]+[/color] 1 [br]loop [br]displayleveldepth [color=#0000ff]=[/color][color=#ff00ff]"指定的文件夾是嵌套級為 "[/color] [color=#0000ff]&[/color] n [color=#0000ff]&[/color] [color=#ff00ff]" [/color][br]的文件夾。[color=#0000ff]<[/color]br[color=#0000ff]>[/color][color=#ff00ff]"& [/color][br][br][br]path [br]end if [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'//==================================磁盤操作================================== [/color][br][color=#ff00ff]'驅(qū)動器是否存在? [/color][br][color=#ff00ff]'response.write reportdrivestatus("c:\") [/color][br][color=#0000a0][b]function[/b][/color] reportdrivestatus[color=#0000ff]([/color]drv[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:判斷磁盤是否存在 [/color][br][color=#ff00ff]'//形參:磁盤 [/color][br][color=#ff00ff]'//返回值:成功為1,失敗為-1 [/color][br][color=#ff00ff]'// [/color][br]dim msg [br]msg [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]if fso[color=#0000ff].[/color]driveexists[color=#0000ff]([/color]drv[color=#0000ff])[/color] then [br]msg [color=#0000ff]=[/color] 1 [br]else [br]msg [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end if [br]reportdrivestatus [color=#0000ff]=[/color] msg [br]end [color=#0000a0][b]function[/b][/color] [br][br][br][color=#ff00ff]'--------可用的返回類型包括 fat、ntfs 和 cdfs。 [/color][br][color=#ff00ff]'response.write showfilesystemtype("c:\") [/color][br][color=#0000a0][b]function[/b][/color] showfilesystemtype[color=#0000ff]([/color]drvspec[color=#0000ff])[/color] [br][color=#ff00ff]'//功能:磁盤類型 [/color][br][color=#ff00ff]'//形參:磁盤名 [/color][br][color=#ff00ff]'//返回值:成功為類型:fat、ntfs 和 cdfs,失?。?1 [/color][br][color=#ff00ff]'// [/color][br]dim d [br]if reportdrivestatus[color=#0000ff]([/color]drvspec[color=#0000ff])[/color] [color=#0000ff]=[/color] 1 then [br]set d [color=#0000ff]=[/color] fso[color=#0000ff].[/color] getdrive[color=#0000ff]([/color]drvspec[color=#0000ff])[/color] [br]showfilesystemtype [color=#0000ff]=[/color] d[color=#0000ff].[/color]filesystem [br]else [br]showfilesystemtype [color=#0000ff]=[/color] [color=#0000ff]-[/color]1 [br]end [color=#800000][b]if[/b][/color] [br]end [color=#0000a0][b]function[/b][/color] [br][color=#0000ff]%[/color][color=#0000ff]>[/color] [/p]

該文章在 2010/7/22 21:58:40 編輯過
關(guān)鍵字查詢
相關(guān)文章
正在查詢...
點(diǎn)晴ERP是一款針對中小制造業(yè)的專業(yè)生產(chǎn)管理軟件系統(tǒng),系統(tǒng)成熟度和易用性得到了國內(nèi)大量中小企業(yè)的青睞。
點(diǎn)晴PMS碼頭管理系統(tǒng)主要針對港口碼頭集裝箱與散貨日常運(yùn)作、調(diào)度、堆場、車隊(duì)、財(cái)務(wù)費(fèi)用、相關(guān)報(bào)表等業(yè)務(wù)管理,結(jié)合碼頭的業(yè)務(wù)特點(diǎn),圍繞調(diào)度、堆場作業(yè)而開發(fā)的。集技術(shù)的先進(jìn)性、管理的有效性于一體,是物流碼頭及其他港口類企業(yè)的高效ERP管理信息系統(tǒng)。
點(diǎn)晴WMS倉儲管理系統(tǒng)提供了貨物產(chǎn)品管理,銷售管理,采購管理,倉儲管理,倉庫管理,保質(zhì)期管理,貨位管理,庫位管理,生產(chǎn)管理,WMS管理系統(tǒng),標(biāo)簽打印,條形碼,二維碼管理,批號管理軟件。
點(diǎn)晴免費(fèi)OA是一款軟件和通用服務(wù)都免費(fèi),不限功能、不限時間、不限用戶的免費(fèi)OA協(xié)同辦公管理系統(tǒng)。
Copyright 2010-2025 ClickSun All Rights Reserved