code to move multiple files from one folder to another?

33 views
Skip to first unread message

Matthew Hirsch

unread,
Apr 13, 2021, 10:59:31 AM4/13/21
to mapi...@googlegroups.com

Is there a way to add code to move a group of files from one folder to another?

For example, I have a large group of order files that we download.   We open them in mapinfo, process the data into a larger file, then save the individual files in a storage folder.

So moving all files  from C:/temp/download/orders to F:/orders.

 

I know I can create a batch file to do this, but am trying to see if I can do it all in one MB script.

Thanks.

Andrew N

unread,
Apr 15, 2021, 8:30:36 AM4/15/21
to MapInfo-L

Hi,

Please see the example attached of how you could achieve this. It will create a batch file, run it, then delete the batch file when done using mapbasic. 
To pause the mapbasic program until the cmd has finished, the final command in the batch file writes to Cmd_Holder.txt, a loop is inserted immediately after running the batch file that checks for the existence of the Cmd_Holder.txt file, using the FileExists command. Finding the file breaks out of the loop and then the mapbasic program will continue on.

Regards
Andrew

File_Transfer.txt
Reply all
Reply to author
Forward
0 new messages