(wie kann ich am besten den ganzen Verzeichnis kopieren ohne die Unterverzeichnise nur die Datein, ich moechte in mein Program ein Backup Funktion machen und alle Datein speichere ich im File Internal Verzeichnis
und ich moechte jetzt ein Verzeichnis ersten in File Internal und dorthin alle Datein kopieren, dann wenn ich wieder herstellen moechte dann alle Datein von backup Verzeichnis wieder ins File Internal kopieren, danke fuer deine Hilfe)
ps.: sorry fuer mein Deutsch ist etwas eingerosttet
I think the problem is this: File.DirInternal & savepos,"01.txt"
You are trying to add a number to the DirInternal directory which is not possible. I think that you want to create a subdirectory.
If yes you must first define the subdirectory before you can access it.
Or perhaps try this, I don't know if the system creates a directory if it doesn't exist. File.DirInternal & "/" & savepos,"01.txt"
i am creating the directory before i try to copy the files
maybe as you allready said that numbers wont work as directory
i will try to add another directory name and try to copy my files
but i dont understand why the error massage says that he cannot find the files
in my file.dirinternal ??
seems like he cannot get the files i want to copy
can you post a simple copy code sample that copies all files in a directory without subdirectories only files?
I don't really understand why you want to copy files from DirInternal to a subfolder of DirInternal.
DirInternal is a folder belonging to the program, no other program can access it.
I don't have a routine out of the box.
I would need, like you, to write one.
You have the function File.ListFiles(TheGivenDirectory) that lists all files and subdirectories in TheGivenDirectory.
Then you can check if the items in the list are directories or files with File.IsDirectory(Dir, Filename).
I want to make a backup function in my program and all file i
Saved in file.internal and i would like ti create a subfolder in
It and copy all files from interbal to it
Then when j would like ti restore copy back from subfolder
To dir internal
'Copies all files from SourceDir to DestinationDir
Sub CopyFiles(SourceDir As String, DestinationDir As String)
Dim lst As List
Dim FileName As String
lst = File.ListFiles(SourceDir)
For i = 0 To lst.Size - 1
FileName = lst.Get(i)
If File.IsDirectory(SourceDir, FileName) = False Then
File.Copy(SourceDir, FileName, DestinationDir, FileName)
End If
Next
End Sub