Hello
I want to move a file to a folder. First I created a folder from files' name .After that I want to move the file to the folder. You can see my codes belor ;
NewFolderName:=COPYSTR(FileName,STRLEN(FileName)-1,2);
FolderName := ENVIRON('TEMP')+'\'+NewFolderName;
IF ISCLEAR(NewFolder) THEN
CREATE(NewFolder);
IF NOT NewFolder.FolderExists(FolderName) THEN
NewFolder.CreateFolder(FolderName);
//this part doesnt work
//NewFolder.MoveFile(ENVIRON('TEMP')+ '\'+FileName+'.jpg', -
//ENVIRON('TEMP')+'\'+NewFolderName);
Thank you
0
Answers
Here a solution with File System Objet
Regards
thank you
Does the codesnippes work or comes an error?
You can see the error message at the attachment..
thank you
You can check this with the virtual table "file" and a filter on "Is File"
or with FSO.FileExists('C:\Fold1\WS_FTP.LOG');
Where is the problem ? I cant see it
StoringFiles(FileName : Text[250])
NewFolderName:=COPYSTR(FileName,STRLEN(FileName)-1,2);
//FolderName := ENVIRON('TEMP')+'\'+NewFolderName;
FolderName := 'C:\Documents and Settings\SY\My Documents\Temp\'+NewFolderName;
IF ISCLEAR(NewFolder) THEN
CREATE(NewFolder);
IF NOT NewFolder.FolderExists(FolderName) THEN
NewFolder.CreateFolder(FolderName);
IF EXISTS('C:\Documents and Settings\SY\My Documents\Temp\'+FileName+'.jpg') THEN
MESSAGE('I found the file');
NewFolder.MoveFile('C:\Documents and Settings\SY\My Documents\Temp\'+FileName+'.jpg',
'C:\Documents and Settings\SY\My Documents\Temp\'+NewFolderName);
CLEAR(NewFolder)
I just send this value "127906". this is the name of the jpg.
FILE.COPY('C:\Documents and Settings\SY\My Documents\Temp'+ '\'+FileName+'.jpg',
'C:\Documents and Settings\SY\My Documents\Temp'+'\'+NewFolderName+ '\'+FileName+'.jpg');
FILE.ERASE('C:\Documents and Settings\SYMy Documents\Temp'+ '\'+FileName+'.jpg');
Thank you for your answer