Hi! I wanna take a 300 files from a folder, I know their extensions but I dont Know what is their name. I would like how to do to rename each one and move into another folder. I found 2 post where explains the code but I can run it into navision. Can I do it with codeunit or with dataport?
Does anyone help?
A lot of thanks!
0
Comments
recFile record : File
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
2) loop through the file-table
3) use the navision rename command
hope this helps
thomas
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I believe, there are 2 tasks are involved.
1. Renaming the file
2. Moving (same as copy pasting) the file to a new location.
I hv achieved the above tasks with a very simple procedure:
1. used the file record to traverse through the files.
2. created a batch file (.BAT) having dos commands (Move %1 %2)
3. Called the Batch file with navision Shell function.
Filerec.setrange(Path,<ur location>);
IF Filerec.FINDFIRST THEN
Repeat
Shell('<Batch file>',Filerec.Path + '\'+Filerec.name + ' ' + <New file name with path of new location>);
Until Next = 0;
Message(Processing Complete');
Thanx
Snehanshu
With this you can use "cmd.exe /C move ..." and you can avoid the dos-box.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
you could just loop through the files with the help of the virtual file table as kriki described and then use the "File.rename"-command somehow like this:
p.s. i recomend to always use the absolute path 'cause nav tends to mess with the workingfolder.