Subject |
Re: deleting files in a remote directory |
From |
Akshat Kapoor <akshat.kapoor@kapoorsons.in> |
Date |
Fri, 10 Aug 2018 19:26:30 +0530 |
Newsgroups |
dbase.getting-started |
On 10/08/2018 19:02, Charlie wrote:
> Hi Akshat... A new chapter is Charlie's coding experiences opened up on this. I never understood arrays before. This is really cool. Thanks so much!!!
>
I also do not like arrays and use them as a last resort.
Just copy and paste from help file with little modifications.
You will be required to make just 2 modifications.
1. Add path
2.Change ? to delete file or new file().delete()
And this should solve your problem
Just proceed with a cool mind and it will be done in no time.
#define ARRAY_DIR_NAME 1
#define ARRAY_DIR_SIZE 2
#define ARRAY_DIR_DATE 3
#define ARRAY_DIR_TIME 4
#define ARRAY_DIR_ATTR 5
aFiles = new Array()
nFiles = aFiles.dir("c:\dbasewin\pictures-temp\*.jpg")
for nFile = 1 to nFiles
delete file &aFiles[ nFile, ARRAY_DIR_NAME ]
endfor
Try the above code.
There is a plan B also
set procedure to miscapi.prg
runhidden("Del c:\dbasewin\pictures-temp\*.jpg")
Just 2 lines will be sufficient.
Miscapi.prg is a part of duflp. If you do not have it have a look at
signature block in any of Ken's replies
runhidden creates a dos batch file junk.bat and then executes it.
If for some reason the above code does not work open a dos command
prompt and try executing "Del c:\dbasewin\pictures-temp\*.jpg" without
the quotes. And adjust according to the error recd.
Regards
Akshat
|
|