cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
AD1
AD1
Level III

How to copy Directories from one place to another?

Hi,

I have run into a problem all of a sudden. I wish to copy files and directories and I am not able to do that anymore.

I use Copy File() and Copy Directory().

Somehow Copy Directory() doesn't recognize my paths anymore or occasionally fails.

So, I would like to know:

1. How to copy a directory (say D:/copyme) inside another directory (D:/destination) ? So that I have D:/destination/copyme as the final result.

2. How can I copy the contents of a directory (say D:/copyme) inside another directory (D:/destination)?

 

Everything was working fine but it stopped working and I couldn't copy reliably anymore. I thought the path is longer for windows to handle that's why it doesn't work but it turns out the path is less than 260 characters for each file. The path contains spaces and hyphens beside numbers and letters.

 

Thanks a lot for your inputs!

4 REPLIES 4
AD1
AD1
Level III

Re: How to copy Directories from one place to another?

Update: Another thing is that if I specify a path as a string, say,

path = "/D:/some_directory/some_other_directory";

and then pick this directory 

 same_path = Pick Directory();

The two paths visually look exactly the same but on comparison

if( path == same_path,
    print("same path");,
    print("not same");
);

 I always get "not same". It was working earlier. Why specifying the path as a string not working?

 

Thanks

AD1
AD1
Level III

Re: How to copy Directories from one place to another?

Correction : path = "/D:/some_directory/some_other_directory/";

Re: How to copy Directories from one place to another?

Should your literal character string for the first path start with a slash?

AD1
AD1
Level III

Re: How to copy Directories from one place to another?

Hi mark,
If I run Pick Directory() function and Show() or print the output, I always get a "/" in the beginning of the path and "/" at the end of the path. That's why I use it and it worked too.

Anyway, it seemed like there was something wrong with the system. I don't see the problem anymore.

Thanks for your inputs!