Need to copy a directory structure from one server to another
Hello All,
I have got a dev server and a production server will call it as D server and P server.
I have a dir structure in my D server and i need to create the same dir structure in P server also using a shell script.
If i do a find . in my D server, i am getting an o/p like :-
.... and so on .. D server contains directories like :-
Inside this lot of other dir/files ..
So I need to create files and directories (with same content)as we can see in D server to P server. I am using a mail parsing mechanism to create files and directories in P server. It is like :-
My worry is how will i create the exact file/dir structure ..?
Thanks in advance
Renjesh
Last edited by Franklin52; 03-08-2011 at 03:10 AM..
Reason: Please use code tags, thank you
on D server got to place where you did find command
if you have scp/rcp/ftp allowed it is much easier
copy all the files to P server
if you have to mail ... remember you cannot mail like you do for text file.
you need to encode the file before you email.
now on production server
Please note command carefully
tar - create tar archive
z - Gzip it
c - CREATE (which is done on DEV D server)
v - verify show what it has done ...
f -- file to be used
x - extract (which is done on PROD server)
if you need a script decide how files are compressed and rcvd on production. also verify userid permission etc before you copy etc ...
there are easier ways like rsync to copy files and cvs/version control etc to make it structured ...
No, I have to do email parsing since i dont have access to P server. I can only use email parsing...
I have got the idea but dont know how to implement ..
Algorithm will be like :-
1) find . will give all the files and dir in the desired location
2) store the o/p to an array
3) if it is a dir --> use parsing method to create dir
4) if it is a file --> use parsing method to create file
and so on ..
This is the logic i want ..
Please help me out to complete this since i am not familiar with array and all ....
It is not possible since i dont have access to create folders or dir in P server...
Please tell me how to read entries into an array .
Example :-
/opt/src
/etc/sys
...
...
I need to store "/opt/src" as first element in the array and "/etc/sys" as second and so on ..
Then I need to check if the first element in the array is a dir .. then i will use email parsing to create the same in p server ..
Hi,
I have a serverA with Directory "/opt/app/myfiles" which is 8.5GB with more than 40000 files and 45 folders in it.
I wish to transfer the folder "/opt/app/myfiles" tree structure with all the sub-directories and skip all files to another serverB.
I would appreciate a command that... (4 Replies)
Hello, I already do some question about this topic. I already establish the conection from the server (Centus) whit the windows PC using SSH. Now I have two problems:
1- The server always ask me about a password to copy the files to the windows pc, I don't know how to avoid this, if someone can... (2 Replies)
Hello Unix Gurus Who I Hope Reads This,
I have quasi-inherited control over a Linux cluster at a university research lab. The post-doc that set it up is gone, and the person in charge of administering the cluster doesn't know a ton about Linux. Amongst other things, I want to use the cluster... (0 Replies)
Hi Expert Team,
I performed the below piece of code to copy the latest file in the remote server's directory to the same server's other directory.
But it is not working properly.
How can i handle this? Can you please help me..?
ssh ${REMOTE_USERID}@${REMOTE_HOSTNAME} "cp -p `ssh... (3 Replies)
I am trying to write a script which has to copy the directory structure from my system to another system on the network. But I dont want the files to be copied.
I think I have to start with copying all subdirectories names in a directory to a system on the network.
Here's the case:
Source... (1 Reply)
I have the below code to recurse through a given file path. I am able to go to the leaf level once recursively but traversing out is not possible as the required varaibles don't have the values on return. Both typeset and local don't work for my variable definitions. I have the o/p of the sample... (2 Replies)
i have a text file as.
/database/sp/NTR_Update_Imsi_List.sql
/database/sp/NTR_Update_Imsi_Range_List.sql
/database/sp/NTR_Vlr_Upload.sql
/database/tables/StatsTables.sql
/mib/ntr.mib
/mib/ntr.v2.mib
/scripts/operations/ntr/IMSITracer.ph
/scripts/operations/ntr/IMSITracer.pl ... (3 Replies)
Hi,
I am trying to write a script that will move all the files from source directory structure(multiple levels might exist) to destination directory structure. If a sub folder is source doesnot exist in destination then I have to skip and goto next level. I also need to delete the files in... (4 Replies)
Hi all
Is it possible to copy a structure of a directory only.
e.g.
I have a file with the following entries that is a result of a find :-
/dir1/dir2/file.dbf
/dir1/dir2/dir3/file1.dbf
/dir1/file.dbf
I want to copy these to a directory and keep the structure however starting at a new dir... (8 Replies)