Jump to content
Macro Express Forums

Copy a specific file within a folder.


Recommended Posts

I copy and rename several hundred files a month, and since I'm doing data entry on them as well, I use Excel to duplicate my efforts. The basic way to do this is to have an excel sheet with a column of file names that you wish to copy, and if applicable, other columns with a new name, or a new destination folder. Have the Macro copy the contents of the first cell into a variable %T1%, move one cell to the right and put the new name into variable %T2%, then move one more cell to the right and set the new folder as variable %T3%, and then use the Copy File or Files command and set the Path to be C:\Offset File\1\%T1%.akx_phase, then for the new name, put in C:\%T3%\%T2%.akx_phase. This will copy the files to a new location.


If your table were as follows:


1_1-18_0004s(25C) A Waffle

1_1-18_01876s(260C) B Waffle


Then after running the macro, you could go to C:\Waffle, and find two files A.akx_phase and B.akx_phase


Note: You will need to use the trim command on the variables to clean them up before you can use them in the name. If I recall correctly, the copied excel cell includes a carriage return.




Another method just occurred to me, and it may work better if you're only doing one or two files, especially if they have long complicated names.


You could use the Variable Set String and use Set Value to File Name (Prompt). This will open up a box for you to select the file, and set the filename to variable %T1%. Then use that same command and use prompt for value, then in that box type the new name you want and set that as varible %T2%. Then you could use the copy command with just %T1% as the name, and then put in the path you want to copy the file to, and append to that the %T2%.akx_phase


Let me know how it works.

Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...