Forum Discussion

Madhi's avatar
Madhi
Contributor
15 years ago

Relative Path for files to attach in the script

I have a situation wherein i have to add some files as attachments.  My script has to run in different machines and I have to attach txt files, xlfiles word doc, pdf files etc in different sizes from 10 to 50MB.

How can I specify relative path in the script so I dont have to modify the script according to each machine. 

The one option i could think of is store the files in the project folder where i can make it generalised by using path for the file =  project.path.



is there anyother way to do it?

3 Replies

  • Hi,



    I'd recommend keeping all your files in Stores (see the "About Files Collection" help topic) or just in the project suite directory.

    If this doesn't suit your needs, keep relative paths to your files in project variables and convert them to absolute paths at run time by using the ExpandFileName method (see the "aqFileSystem.ExpandFileName" help topic). Also, you can store your files in a network share whose path will always be the same on all machines in your network.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    We have several projects that have the same need, where we have CSV files that we use for our data driven testing.  No matter what machine we run them on, we need access.  So, we have a standardized directory structure for each project and for our shared source code.  That directory structure can be referenced, then, using relative pathing within the project using the Project.Path value.