FILE COPY to different directory

Post Reply
User avatar
MarkP
Posts: 71
Joined: Tue Apr 07, 2015 9:32 pm

FILE COPY to different directory

Post 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?

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: FILE COPY to different directory

Post by Mr. Kibernetik »

Can you please specify what problem do you have with copying file to another directory?

User avatar
MarkP
Posts: 71
Joined: Tue Apr 07, 2015 9:32 pm

Re: FILE COPY to different directory

Post 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 ?

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: FILE COPY to different directory

Post 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

Post Reply