aspose file tools*
The moose likes Linux / UNIX and the fly likes Copying specific directory from one server to another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Copying specific directory from one server to another" Watch "Copying specific directory from one server to another" New topic
Author

Copying specific directory from one server to another

Micheal Knight
Greenhorn

Joined: Dec 19, 2007
Posts: 10

What i am trying to do is copy specific folder by the name of testing to my other unix server. This is what my directory structure is in server ABC

/home/web/dummy/mike/images
/home/web/dummy/mike/source
/home/web/dummy/mike/testing

/home/web/dummy/john/images
/home/web/dummy/john/source
/home/web/dummy/john/testing

/home/web/dummy/alex/images
/home/web/dummy/alex/source

As you can see under dummy folders i have 3 different folders. But the folder which i am concern about is (testing) folder. So mike and john have testing , images and source folder. I would like to copy the parent directory which is john or mike and testing folder only to my XYZ server.

When i run my code the first time, it just copies the contents of testing folder without creating a testing folder. But when i ran the script second time everything works fine. Parent directory which is john or mike is copied to my XYZ server and testing folder is also copied under john and mike.

Can someone tell me what is going on? why my script is not creating the testing folder the first time ?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16054
    
  21

You have to use the '-p' option on mkdir if you want to create multiple layers of directories using a single mkdir command.

However, you might want to look into the rsync utility. It's designed specifically to image file directory trees between computers.


Customer surveys are for companies who didn't pay proper attention to begin with.
Micheal Knight
Greenhorn

Joined: Dec 19, 2007
Posts: 10
Ah. Thank you so much. It worked :--).

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Copying specific directory from one server to another