Curtiss W. Posted August 17, 2006 Share Posted August 17, 2006 Ok can you use a variable when you copy a file to change the name? Can you do it on the fly or do you have to rename the file first and then copy it? See Below. FileCopy ( @homedrive &"\Documents and Settings\user\Desktop\autoit-temp\a\test.bat" , @homedrive &"\Documents and Settings\user\Desktop\autoit-temp\b\ @computername & -test.bat", 9) In this case when the file is copied from floder a to folder b I need to add the computer name to the front of the file name. so it starts off as test.bat but need to end up as %computer%-test.bat Thanks is advance for any help. Curtiss W. Link to comment Share on other sites More sharing options...
xcal Posted August 17, 2006 Share Posted August 17, 2006 I don't think you can rename during a filecopy. I believe you need to do a filemove to rename. For what you have, it'll look like this: FileCopy ( @homedrive &"\Documents and Settings\user\Desktop\autoit-temp\a\test.bat", @TempDir, 9) FileMove(@TempDir & "\test.bat", @HomeDrive & "\Documents and Settings\user\Desktop\autoit-temp\b\" & @ComputerName & "-test.bat", 9) How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
Helge Posted August 17, 2006 Share Posted August 17, 2006 Curtiss, why didn't you just this yourself ? I don't see a reason for you to ask this question here really, when you could have found it out in like 10 seconds. Anyway, the answer is yes. Link to comment Share on other sites More sharing options...
xcal Posted August 17, 2006 Share Posted August 17, 2006 Well I'll be... It looks like you can rename during a copy. I didn't think you could since the help file says "Because AutoIt lacks a "FileRename" function, use FileMove to rename a file!" How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now