-
-
Notifications
You must be signed in to change notification settings - Fork 146
In TStartupCopy, provide a way to copy all files in a folder #312
Copy link
Copy link
Open
Description
The current TStartupCopy class works brilliantly. However, if I want to copy (replace) all files in a specific folder or sub-folder, I need to first retrieve a list of their names and pass as the first parameter into CopyDocuments() which does the same.
To save this step and make the use easier, if the AFilenames parameter is passed as an empty array, could it copy all files?
e.g.: (Not the most efficient implementation. Just an example)
for LSourceFileName in TDirectory.GetFiles(LSourcePath, '*.*', TSearchOption.soTopDirectoryOnly) do
begin
LIndex := IndexStr(TPath.GetFileName(LSourceFileName), AFileNames);
if (Length(FileNames) = 0) or (LIndex > -1) then
TFile.Copy(LSourceFileName, TPath.Combine(LDestPath, AFileNames[LIndex]), True);
end;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels