• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

Correct Path not being Passed

I am trying to copy a file from one location to another but my file path seems to be getting "changed" on the way.

I start off with: ThreadProcessFiles processThread = new ThreadProcessFiles(new File(fileList[0]).getAbsolutePath());

But the output in the called class looks like: C:\Documents and Settings\username\workspace\ProjectTestImage-001.tif

Which property should I be passing to have the correct link to the file in the Windows platform?

0
lasutton
Asked:
lasutton
  • 4
  • 2
  • 2
1 Solution
 
CEHJCommented:
>>But the output in the called class looks like: C:\Documents and Settings\username\workspace\ProjectTestImage-001.tif

What is wrong with that and why?
0
 
lasuttonAuthor Commented:
The actual location of the original file is C:\Input\TestImage-001.gif.

0
 
lasuttonAuthor Commented:
My problem was as follows:

When using a ".list" of a directory, the string does not contain the path of the files created.  As the path returns a "null" value the .get..Path.. values return the directory of the running application.  

So the directory name needs to be prefixed to the file name found.

                  File foundFile = new File(directoryToMonitor + File.separatorChar + fileList[0] );
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
objectsCommented:
>                File foundFile = new File(directoryToMonitor + File.separatorChar + fileList[0] );

could also be done using:

File dir = new File(directoryToMonitor);

               File foundFile = new File(dir, fileList[0] );
0
 
CEHJCommented:
>>the .get..Path.. values return the directory of the running application.  

You'll find it's not that directory but the one from where it's being run
0
 
CEHJCommented:
:-)
0
 
objectsCommented:
> You'll find it's not that directory but the one from where it's being run

the directory of the running appication *is* the directory where it is being run from :-D
0
 
CEHJCommented:
?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now