Moving a file to a folder ?

snyktp
Member Posts: 75
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
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
-
For a better help it would be "perfect" if you write what for an type (automation) is NEWFolder and what for an error message pops up
Here a solution with File System Objet//Variables //Name DataType Subtype Length //FSO Automation 'Windows Script Host Object Model'.FileSystemObject if isclear(FSO) then create(FSO); FSO.MoveFile('C:\Fold1\WS_FTP.LOG','C:\Fold2\'); clear(FSO);
RegardsDo you make it right, it works too!0 -
newfolder - Automation - 'Microsoft Scripting Runtime'.FileSystemObject
thank you0 -
so, you see, it's a good one to give variables unique names ;-)
Does the codesnippes work or comes an error?If error then ShowMeTheError;
Do you make it right, it works too!0 -
Does the file and the source / destination folder exist?
You can check this with the virtual table "file" and a filter on "Is File"
or with FSO.FileExists('C:\Fold1\WS_FTP.LOG');Do you make it right, it works too!0 -
It can find the file..there isnt any problem for finding the file.
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)0 -
Whats the whole value of the variable FileName : Text[250] :?:Do you make it right, it works too!0
-
StoringFiles('127906');
I just send this value "127906". this is the name of the jpg.0 -
I use below codes instead of newFolder.MoveFile. It works as I want
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 answer0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions