Copy file A to B

I try to copy file from place A to place B, I tough it should be dead easy like
copy from "c:/temp/my.text" to "d:/temp/my.text" but it's not so easy.
I have to copy 3dsmax.ini file, first check where it is(is usually under user/appdata etc so I cant use straight path because user name path) then copy this ini to "c"\temp" and I have to do with one more file, then I must delete oryginal ini. I'm not skilled in maxscript so I want keep code as simple as possible. I would be grate full some clue, I already search in max help but I don't get how to do it. It's really simple operation. The code is below but it doesn't work.

fn getFilesRecursive root pattern =
(
dir_array = GetDirectories (root+"/*")
for d in dir_array do
join dir_array (GetDirectories (d+"/*"))
my_files = #()
for f in dir_array do
join my_files (getFiles (f + pattern))
my_files
)
-- get filepath for 3dsmax.ini
INIname=getFilesRecursive "c:/users" "3dsmax.ini"
INInameb=getMAXIniFile()

-- name for new folders
mdfilepatA="C:\temp\1"
mdfilepatB="C:\temp\2"

-- check if 3dsmax ini exist, if exist then do
INIexistmd=INIname as string
if INIexistmd=="#()" then
(
-- if txt file don't exist then
messagebox "There is no ini file to copy"
---- create openlog
)
else
(
messagebox "start"

--create directory
makeDir @"C:\temp\1" all:false all:false
makeDir @"C:\temp\2" all:false all:false
-- copy files
copyFile INIname mdfilepatA
copyfile INInameb mdfilepatB
--deleteFile oryginal ini file
deletefile INIname
deletefile INInameb

)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
barigazy's picture

...

Can you simplify question.
Are you want to find all *.ini files from maxroot folder and move them to newly created folder

bga

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.