# How to move a imported txt file from one folder to the other fold after running dataport.

**URL:** <https://www.dynamicsuser.net/t/how-to-move-a-imported-txt-file-from-one-folder-to-the-other-fold-after-running-dataport/17266>\
**Category:** Developers Forum\
**Created:** [August 28, 2007, 10:20am UTC](https://www.dynamicsuser.net/t/how-to-move-a-imported-txt-file-from-one-folder-to-the-other-fold-after-running-dataport/17266 "2007-08-28T10:20:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cngillie](https://avatars.discourse-cdn.com/v4/letter/c/a88e57/32.png) [@cngillie](https://www.dynamicsuser.net/u/cngillie)\
**Post date:** [August 28, 2007, 10:20am UTC](https://www.dynamicsuser.net/t/how-to-move-a-imported-txt-file-from-one-folder-to-the-other-fold-after-running-dataport/17266/1 "2007-08-28T10:20:01Z")

</div>

Now I am developing a dataport to import some general journal lines. In order to make sure that some text file is imported only once, I want to make the following function happened:  
Once dataport import is done, the dataport will automatically move the text file from the current folder to another folder. But I am not sure of the command. SHELL command… or something else… and how to write the source code?

Would you guys give some hints? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![sander7](https://avatars.discourse-cdn.com/v4/letter/s/f17d59/32.png) [@sander7](https://www.dynamicsuser.net/u/sander7)\
**Post date:** [August 28, 2007, 10:47am UTC](https://www.dynamicsuser.net/t/how-to-move-a-imported-txt-file-from-one-folder-to-the-other-fold-after-running-dataport/17266/2 "2007-08-28T10:47:43Z")

</div>

Hi cngillie,

I’ve done this by creating a processing only report, that calls the dataport, and then afterwards renames the file.

IF FILE.EXISTS(FileNameText) THEN  
FILE.RENAME(FileNameText,NewFileNameText);

Don’t know if this is the optimal way, but it worked for me.

---

<div class="post-metadata">

**Author:** ![David\_Singleton](https://sea1.discourse-cdn.com/flex023/user_avatar/www.dynamicsuser.net/david_singleton/32/7471_2.png) [@David\_Singleton](https://www.dynamicsuser.net/u/David_Singleton)\
**Post date:** [August 28, 2007, 12:13pm UTC](https://www.dynamicsuser.net/t/how-to-move-a-imported-txt-file-from-one-folder-to-the-other-fold-after-running-dataport/17266/3 "2007-08-28T12:13:26Z")

</div>

> [@](#):
>
> Hi cngillie,
> 
> I’ve done this by creating a processing only report, that calls the dataport, and then afterwards renames the file.
> 
> IF FILE.EXISTS(FileNameText) THEN  
> FILE.RENAME(FileNameText,NewFileNameText);
> 
> Don’t know if this is the optimal way, but it worked for me.

[Y]

I think this is the best way. The major problem otherwise, is that the DataPort locks the file, an having the DataPort directly rename the file most often does not work.

---

<div class="post-metadata">

**Author:** ![cngillie](https://avatars.discourse-cdn.com/v4/letter/c/a88e57/32.png) [@cngillie](https://www.dynamicsuser.net/u/cngillie)\
**Post date:** [August 30, 2007, 9:08am UTC](https://www.dynamicsuser.net/t/how-to-move-a-imported-txt-file-from-one-folder-to-the-other-fold-after-running-dataport/17266/4 "2007-08-30T09:08:25Z")

</div>

thanks very much!
