Page 1 of 1

FILE COPY to different directory

Posted: Fri Apr 10, 2015 3:28 am
by MarkP
Does there exist a way to use the DIR SET command and the FILE COPY command to programmatically copy files to a DIFFERENT directory?

Re: FILE COPY to different directory

Posted: Fri Apr 10, 2015 3:49 am
by Mr. Kibernetik
Can you please specify what problem do you have with copying file to another directory?

Re: FILE COPY to different directory

Posted: Fri Apr 10, 2015 6:07 am
by MarkP
For example, I want to copy all files in directory "aaa" to "bbb", which already contains other files.
Using DIR SET, I can set only one current directory at a time.

I think I have solved the problem as follows:

OPTION BASE 1
d1$="aaa"
d2$="bbb"

DIR d1$ LIST FILES A$,B
DIR d1$ SET
FOR i=1 TO B
FILE A$(i) COPY "../" & d2$ & "/" & A$(i)
NEXT i

This seems to work. Initially, I mistakenly used "\" instead of "/" (I tend to work on PC a lot).
This actually caused hidden files to be created in the "aaa" directory such as "..\bbb\file1", etc.
These hidden files did not appear in the directory, but would be gathered by the DIR LIST FILES command.
Is it true that in SmartBasic, files starting with "." are hidden ?

Re: FILE COPY to different directory

Posted: Fri Apr 10, 2015 6:11 am
by Mr. Kibernetik
Yes, it is correct to use "/" as a folder separator on iOS.
Also files starting with "." are hidden in iOS.

Now you know a lot about iOS files structure :D