Jump to content
Macro Express Forums

Using a variable in a file path name


Sunnyboy
 Share

Recommended Posts

Hi evryone,

 

I've tried to look over the previous post to find a related post. My search was not successfull. So heres my issue.

 

I'm trying to copy a file from one folder to an other one from a txt file list.

 

My list contains a number of file I need to copy

Example :

(File #1) 123456789.doc

(File #2) 144400012.doc

 

The file path for each file will vary depending on the first 4 numbers of the file.

 

(File #1) C:\Windows\1234\123456789.doc

(File #2) C:\Windows\1444\144400012.doc

 

My question now is how do i use the File command: Files/Folders >Copy File or Files with a variable such as (%T1%) in the file(s) Path Name. If it can be used with tha function, how can I do it.

 

Thanks evryone for your help. :)

 

Louis

Link to comment
Share on other sites

how do i use the File command: Files/Folders >Copy File or Files with a variable such as (%T1%) in the file(s) Path Name.

Anywhere you can type something, like the Copy File or Files command dialog, you can include variables. This should get you started:

// Get the Windows directory
Variable Set String %T10% from Environment Variable

Text File Begin Process: "input.txt"
 // Copy first 4 characters of filename
 Variable Modify String: Copy Part of %T1% to %T2%
 Copy File or Files: "%T1%"
Text File End Process

The macro is attached.

Sample CopyFilesUsingVariable.mex

Link to comment
Share on other sites

  • 2 weeks later...

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