FILE COPY to different directory
FILE COPY to different directory
Does there exist a way to use the DIR SET command and the FILE COPY command to programmatically copy files to a DIFFERENT directory?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: FILE COPY to different directory
Can you please specify what problem do you have with copying file to another directory?
Re: FILE COPY to different directory
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 ?
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 ?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: FILE COPY to different directory
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
Also files starting with "." are hidden in iOS.
Now you know a lot about iOS files structure