Android实例-路径信息及文件和文件夹的操作(XE8+小米2)
来源:互联网 发布:淘宝新开店铺怎么运营 编辑:程序博客网 时间:2024/05/13 07:14
unit Unit1;interfaceuses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.ScrollBox, FMX.Memo, FMX.Controls.Presentation, FMX.StdCtrls;type TForm1 = class(TForm) Button1: TButton; Memo1: TMemo; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button5Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementationuses System.IoUtils;{$R *.fmx}{$R *.NmXhdpiPh.fmx ANDROID}procedure TForm1.Button1Click(Sender: TObject);begin Memo1.Lines.Clear; Memo1.Lines.Add('GetTempFileName:' + TPath.GetTempFileName); Memo1.Lines.Add('GetTempPath:' + TPath.GetTempPath); Memo1.Lines.Add('GetHomePath:' + TPath.GetHomePath); Memo1.Lines.Add('GetDocumentsPath:' + TPath.GetDocumentsPath); Memo1.Lines.Add('GetSharedDocumentsPath:' + TPath.GetSharedDocumentsPath); Memo1.Lines.Add('GetLibraryPath:' + TPath.GetLibraryPath); Memo1.Lines.Add('GetCachePath:' + TPath.GetCachePath); Memo1.Lines.Add('GetPathRoot:' + TPath.GetPathRoot(TPath.GetCachePath)); Memo1.Lines.Add('GetPublicPath:' + TPath.GetPublicPath); Memo1.Lines.Add('GetPicturesPath:' + TPath.GetPicturesPath); Memo1.Lines.Add('GetSharedPicturesPath:' + TPath.GetSharedPicturesPath); Memo1.Lines.Add('GetCameraPath:' + TPath.GetCameraPath); Memo1.Lines.Add('GetSharedCameraPath:' + TPath.GetSharedCameraPath); Memo1.Lines.Add('GetMusicPath:' + TPath.GetMusicPath); Memo1.Lines.Add('GetSharedMusicPath:' + TPath.GetSharedMusicPath); Memo1.Lines.Add('GetMoviesPath:' + TPath.GetMoviesPath); Memo1.Lines.Add('GetAlarmsPath:' + TPath.GetAlarmsPath); Memo1.Lines.Add('GetSharedAlarmsPath:' + TPath.GetSharedAlarmsPath); Memo1.Lines.Add('GetDownloadsPath:' + TPath.GetDownloadsPath); Memo1.Lines.Add('GetSharedDownloadsPath:' + TPath.GetSharedDownloadsPath); Memo1.Lines.Add('GetRingtonesPath:' + TPath.GetRingtonesPath); Memo1.Lines.Add('GetSharedRingtonesPath:' + TPath.GetSharedRingtonesPath);end;procedure TForm1.Button2Click(Sender: TObject);begin if TFile.Exists(TPath.GetTempFileName) then begin Memo1.Lines.Clear; Memo1.Lines.Add('存在'); end;end;procedure TForm1.Button3Click(Sender: TObject);begin if not TDirectory.Exists(TPath.GetTempPath + 'NewDirectory') then TDirectory.CreateDirectory(TPath.GetTempPath + 'NewDirectory');end;procedure TForm1.Button4Click(Sender: TObject);var sFile1: string; sFile2: string;begin sFile1 := TPath.GetTempPath + '123.jpg'; sFile2 := TPath.GetTempPath + '456.jpg'; if not TFile.Exists(sFile1) then begin TFile.Copy(sFile1, sFile2); end;end;procedure TForm1.Button5Click(Sender: TObject);var Files: TStringDynArray; I: Integer;begin if TDirectory.Exists(TPath.GetTempPath + '/temp/') then begin Files := TDirectory.GetFiles(TPath.GetTempPath + '/temp/'); for I := 0 to high(Files) do begin TFile.Delete(Files[I]); end; end;end;end.
结果:
GetTempFileName:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/tmp/tmp.iQIip24407
GetTempPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/tmp
GetHomePath:/data/data/com.embarcadero.Project1/files
GetDocumentsPath:/data/data/com.embarcadero.Project1/files
GetSharedDocumentsPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files
GetLibraryPath:/data/data/com.embarcadero.Project1/lib
GetCachePath:/data/data/com.embarcadero.Project1/cache
GetPathRoot:/
GetPublicPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files
GetPicturesPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/Pictures
GetSharedPicturesPath:/storage/sdcard0/Pictures
GetCameraPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/DCIM
GetSharedCameraPath:/storage/sdcard0/DCIM
GetMusicPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/Music
GetSharedMusicPath:/storage/sdcard0/Music
GetMoviesPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/Movies
GetAlarmsPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/Alarms
GetSharedAlarmsPath:/storage/sdcard0/Alarms
GetDownloadsPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/Download
GetSharedDownloadsPath:/storage/sdcard0/Download
GetRingtonesPath:/storage/sdcard0/Android/data/com.embarcadero.Project1/files/Ringtones
GetSharedRingtonesPath:/storage/sdcard0/Ringtones
- Android实例-路径信息及文件和文件夹的操作(XE8+小米2)
- JAVA 读取某一路径下的文件和文件夹信息
- C#中对文件夹及文件信息的操作
- Android 文件及文件夹操作
- python 文件、文件夹和路径操作笔记
- android 路径及文件操作
- java/android 统计文件夹大小及删除文件夹下所有文件和路径
- java/android 统计文件夹大小及删除文件夹下所有文件和路径
- android 统计文件夹大小及删除文件夹下所有文件和路径
- java/android 统计文件夹大小及删除文件夹下所有文件和路径
- CSharp 文件操作查看文件夹和文件夹信息
- 文件和文件夹的操作
- 文件和文件夹的操作
- 文件和文件夹的操作
- C# 对包含文件或目录路径信息的 System.String 实例执行操作
- java文件操作 之 创建文件夹路径和新文件
- Android adb shell删除文件和文件夹的操作
- 按照文件路径和文件名创建文件夹及下载文件的一些总结
- jpush app 消息推送项目 实例
- ios学习历程记录
- 批量添加删除用户方法三
- git 自动补全 (git auto completion)
- Vector,ArrayList,LinkedList 的区别是什么?
- Android实例-路径信息及文件和文件夹的操作(XE8+小米2)
- UIWebView头文件学习
- hibenate 主键生成策略
- 莫队算法
- Leetcode - 266. Palindrome Permutation
- iOS开发工具——取色工具Sip
- Android webView打不开网页的解决办法
- [一般问题] gradle与gradle wrapper关系,以及版本关系
- android新技术学习(2)-RxJava