Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Script to move a file from one folder to another

Hi,

I was wondering if it is possible to move files to another folder within my QV script?

For example, if I have some files in say a folder called "Upload Data".  Can you move all the files contained in that folder to a folder called "Archive"?

Any help would be greatly appreciated.

Thanks.

7 Replies
Not applicable
Author

you can create vb macto and use it in your QV script

chematos
Specialist II
Specialist II

I think you should use the console command to move files in the load script, I´m not sure but I think is something like this:

execute cmd.exe /c move <Source Folder> <Destiny Folder>;

You need to enable the execution of external programs, if you want to check if the script works you could try with this to delete some file:

execute cmd.exe /c del <File>; //name or path of the file to delete

Hope this helps

Not applicable
Author

Thanks Jose.

I've tried doing that and it doesn't seem to work:

Execute cmd.exe /c del <Z:\My Documents\Test File to Delete.txt>;

Is there something else I should be doing?

whiteline
Master II
Master II

Try without <>.

Look at help 'execute'.

Before writing a command in a script you can always check it with a Windows Command Prompt.

In your case: del <Z:\My Documents\Test File to Delete.txt>

It definetly says that "The syntax of the command is incorrect."

chematos
Specialist II
Specialist II

Yes, the <> were only to mark  that there you had to write the name of the file but you have to discard them

Try this and tell me if wroks fine

execute cmd.exe /c del Z:\My Documents\Test File to Delete.txt;

Regards

Not applicable
Author

Hi whiteline,


Please try this: execute cmd.exe /c del "Z:\My Documents\Test File to Delete.txt";


Regards,



Not applicable
Author

Hi Rk,

I know its very old question. but wanted to reply if some one would use in the future

execute cmd.exe  /c move "C:\Users\kishravi\Desktop\CRM\*.txt" "C:\Users\kishravi\Desktop\CRM\Test\";