Community
PowerMill Forum
Welcome to Autodesk’s PowerMill Forums. Share your knowledge, ask questions, and explore popular PowerMill topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

copy file from one directory to another

6 REPLIES 6
Reply
Message 1 of 7
greg_xpp
495 Views, 6 Replies

copy file from one directory to another

What is the command to copy a file from one directory to another?for example, to open files we use 'OLE FILEACTION 'open'.

is it possible to copy via OLE command?

6 REPLIES 6
Message 2 of 7
ondrej.mikulec
in reply to: greg_xpp

STRING sourceFilepath = "C:\Users\powermill\Documents\cube.dmt"
STRING targetFilepath = "C:\Users\powermill\Documents\cube2.dmt"
STRING batFilePath = "C:\Users\powermill\Documents\copy.bat"

FILE OPEN $batFilePath FOR WRITE AS output

STRING textLine1 = "@echo off"
STRING textLine2 = "set source=" + $sourceFilepath
STRING textLine3 = "set destination=" + $targetFilepath
STRING textLine4 = ""
STRING textLine5 = 'copy "%source%" "%destination%"'

FILE WRITE $textLine1 TO output
FILE WRITE $textLine2 TO output
FILE WRITE $textLine3 TO output
FILE WRITE $textLine4 TO output
FILE WRITE $textLine5 TO output

FILE CLOSE output

OLE FILEACTION 'open' $batFilePath
Message 3 of 7

Hi @ondrej.mikulec,

Your macro is working nice for a file!

But I would ask how can we copy and past a folder to another directory.

 

Message 4 of 7

The macro simply involves creating and executing a batch file, which means you can accomplish most tasks that a batch file can handle. To determine the specific commands to include in the batch file, I suggest seeking assistance for example from ChatGPT.

Message 5 of 7

@ondrej.mikulec :Thank you

Message 6 of 7

Is this possible?IMG_20230630_190450.jpg

Message 7 of 7
Cobra.007
in reply to: greg_xpp

Yes that should be possible, but like this

 

STRING PATH2 = SUBSTRING($ModelName,0,100)

 

Greetings

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report