Copying Files

5 posts / 0 new
Last post
mwiger
Offline
Joined: 07/29/2021 - 10:01
Copying Files

Hello,
 
I wasn't really sure where to post this.
 
Currently, I have a macro that performs some analysis and exports out a couple excel files. I am looking to copy Excel files from my Exports.ILB folder to a folder on a Network drive.  The folder will vary in name depending on the project that I am in, but I would like to have it create a folder within that folder called "Exports" and then copy the files to the "Exports" folder.  For example, I would like the files to be copied to
 
U:\Mike W\ProjectName\Exports
 
I would also like for it to be able to check if the "Exports" folder exists and if it does copy the files to there and overwrite any files already in there.  Another thing I would like to include is the current directory.  This macro will be used across multiple projects.  My plan is to have the project name be the same as the ProjectName from above. 
 
I have seen multiple ways to copy files using IDEAScript and Python.  What would you recommend to use and could someone point me in the right direction to get started.
 
Thank you!

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi there, 

Just a question before responding as this is easly done with the ms filesystemobject object.  If you do a search on this one you will get lots of ways to make it work.

Instead of doing a copy why not do the export directly from IDEA?

mwiger
Offline
Joined: 07/29/2021 - 10:01

Hi Brian,
 
Thanks for getting back to me.  I thought about that but for my sanity I would like to have a copy of the file on my machine as well.  Just in case something happens and we can't access the network drive where it will be copied.

mwiger
Offline
Joined: 07/29/2021 - 10:01

Ohh, I think I may have understood more of what you were saying.  I can do two exports one to mine and the other to the network drive.  Is that what you meant?  That would be a lot easier!  I feel like a dummy.
 
Thank you!

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Well you can do it either way, write a bunch of code to copy the files, that is doable but like you pointed out the easiest approach is just do a second export for the backup.  Lot easier to write as you don't have to write an special code.