Jump to content
Macro Express Forums

Copying Specific Files


Leigh
 Share

Recommended Posts

We have test and live intranet servers both of which I have file access to via UNC paths. Normally I make changes to the files on the test server and then I have to copy the files to the live server. The biggest issue is that I can only copy the folder I am currently working on and not the entire intranet as other people may be making changes to other folders at the same time. The folder I need to change is not always the same so I can't hard code the paths either.

 

My first attempt to solve this using a macro involved copying the name of the folder I am working on to the clipboard and then running a macro to save the clipboard text to a file, and then read the file into a variable, and then run the Copy command with the source from our test intranet as

\\Ephraim\IT\Programming\Web\Web Site Folders\pccnet.pcci.edu  older\pccnet.pcci.edu\%T1%\*.*

and the destination on our live intranet as

\\Gideon\Intranet\PCCNet\%T1%\

While this appeared to work in my testing it has the dangerous potential to copy the entire intranet if something is not copied to the clipboard.

 

My current idea is to write a new macro that will open a command prompt and then paste the appropriate copy command text and then allow me to either run it or cancel. This however doesn't seem ideal.

 

What I would like is for the macro to get the file path from my currently open exporer window (which I know it can do) and then create a new text variable replacing the test path with the destination path. With this variable created the copy command could be run with these variables and the entire option would be not only reliable but also transparent to the user.

 

If anyone knows how I could make this work, or another possible method please let me know.

Link to comment
Share on other sites

When you have copied the folder name from the clipboard to a file (presumably text file of some sort) why can't you do some checks on the text stored in the file? If you are using a text file and the folder name is saved rather than appended, then you should have one alphanumeric entry only. If there is nothing or more than one entry then you stop the macro. You could also compare the text against a list of all the folders in the system (use Repeat with Folder to get list). It should match one.

Link to comment
Share on other sites

Ok, that sounds like it should work. Unfortunatly it still relies on a file existing with a particular name in a particular folder. I can do a file existence check, but I don't think I can create the file. Without this the macro isn't portable, nor can I delete this temporary work file when I am done with it.

Link to comment
Share on other sites

I may be missing something because what you are trying to do looks too simple.

 

The procedure I outlined is solely looking at the foldername, not any filenames. The checks I mentioned are on the foldername. I'm assuming you are going to copy the entire folder from your test server to the same name folder on the live server using *.* as the new filename field in the Copy File or Files instruction.

 

test server path\this folder\*.* is folder and files to be copied

"this folder" copied to text file via clipboard

make checks to ensure "this folder" is valid foldername

"this folder" read from text file into text variable to create new path

live server path\this folder\

 

Macro instruction: Copy File or Files

File path(s) name: test server path\this folder\*.*

New name: live server path\this folder\*.*

Link to comment
Share on other sites

Join the conversation

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

Guest
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.

Loading...
 Share

×
×
  • Create New...