Recursive Replication of Unix folders to Windows


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Recursive Replication of Unix folders to Windows
# 1  
Old 04-17-2010
Recursive Replication of Unix folders to Windows

Requirements: ftp files recursively from unix to windows. Replicate
directory paths on unix (source) to windows (destination) and place
files in their respective folders. There are no set number of files per
directory nor fix number of dirA or dirB etc....

Code:
Source OS:        Solaris 10
Source Dir:        
             /dir1/dir2/dirA/file1
             /dir1/dir2/dirA/file2
             /dir1/dir2/dirA/file3
         
             /dir1/dir2/dirB/file1
                 
             /dir1/dir2/dirC/file1
             /dir1/dir2/dirC/file2
 
             ....
        
         
 Destination OS:    Windows 200?
 Destination Dir:    
             /dir1/dir2/dirA/file1
             /dir1/dir2/dirA/file2
             /dir1/dir2/dirA/file3
         
             /dir1/dir2/dirB/file1
                 
             /dir1/dir2/dirC/file1
             /dir1/dir2/dirC/file2
 
             ....

Not sure if this is the best approach this requirement. I would like to have a script that will dynamically create an ftp script to support the above requirements.
Code:
 open HOST
 quote USER _USER
 quote PASS _PASSWORD
  binary

 mkdir dir1
 cd dir1
 mkdir dir2
 cd dir2
 mkdir dirA dirB dirC


 lcd /dir1/dir2/dirA
 cd dir1\dir2\dirA
 mput file*

 lcd /dir1/dir2/dirB
 cd dir1\dir2\dirB
 mput file*

 lcd /dir1/dir2/dirC
 cd dir1\dir2\dirC
 mput file*

 etc....

 bye


Thank you.
mlv_99

Last edited by Scott; 04-17-2010 at 07:26 PM.. Reason: Please use code tags
# 2  
Old 04-17-2010
Hi,

You might want to try rsync. probably
Code:
rsync -avz src/bar foo:dest/

It transfers files recursively from the directory src to machine "foo" the destination directory being dest/
it transfers file in archive mode, preserves symbolic links,attributes,permissions,ownerships and compressions etc.

Regards,
gaurav.
This User Gave Thanks to gaurav1086 For This Post:
# 3  
Old 04-17-2010
You might also consider winscp, it handles both sftp and ftp, and can be scripted, WinSCP :: Download
# 4  
Old 04-17-2010
Recursive Replication of Unix folders to Windows

Thanks for replying gaurav. rsync looks like it can be verify useful, but my requirements are to use FTP. Source is Solaris and destination is Windows with no shell environment. Automation is the other requirement that I fail to mention.

I need to have script that generates an ftp script, that "cd" and mkdir as stated in previous post.

Thanks again.
mlv_99
# 5  
Old 04-17-2010
Hello,

There are openssh versions for windows. You can then employ rsync for the destination as windows boxes. As per automation, rsync is "the best" option . You can distribute the public key on the server(windows) and easily automate the procedure through a bash/perl script over a cron job in solaris.

Regards,
gaurav.
# 6  
Old 04-17-2010
Recursive Replication of Unix folders to Windows

Hi,

We have no access to the remote server. Location of FTP repository. All great suggestions, but requirements states FTP.

Need script to break individual directories into tokens and then generate the ftp script:

Code:
echo "#!/bin/bin" >> ftpscript.sh
echo ""

echo "open HOST _HOST" >> ftpscript.sh
 echo "quote USER _USER" >> ftpscript.sh
 echo "quote PASS _PASSWORD" >> ftpscript.sh
  echo "binary" >> ftpscript.sh

 echo "mkdir dir1" >> ftpscript.sh
 echo "cd dir1" >> ftpscript.sh
 echo "mkdir dir2" >> ftpscript.sh
 echo "cd dir2" >> ftpscript.sh
 echo "mkdir dirA dirB dirC" >> ftpscript.sh


 echo "lcd /dir1/dir2/dirA" >> ftpscript.sh
 echo "cd dir1\dir2\dirA" >> ftpscript.sh
 echo "mput file*" >> ftpscript.sh

 echo "lcd /dir1/dir2/dirB"  >> ftpscript.sh
 echo "cd dir1\dir2\dirB" >> ftpscript.sh
 echo "mput file*"  >> ftpscript.sh

 echo "lcd /dir1/dir2/dirC"  >> ftpscript.sh
  echo "cd dir1\dir2\dirC" >> ftpscript.sh
  echo "mput file*"  >> ftpscript.sh

 etc....

 echo "bye" >> ftpscript.sh

The part I am having trouble with is the part that tracks each directory. The master script must track the directory path in order for it to generate the "ftpscript.sh" as seen above. The master script (and not the ftpscript.sh) will read each of the directory paths and generate the ftpscript.sh above.

Hope that is clearer. Thanks your your suggestions!!!!

Regards,
mlv_99

Last edited by Scott; 04-17-2010 at 07:28 PM.. Reason: Code tags please...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Perl] Module for recursive listing of remote Windows shares

Hi, I'm looking for a Perl module which can recursively list remote Windows shares from within a Linux machine. I've tried Filesys::SmbClient ans Filesys:SmbClientPars but they just list the current directory Thank You for your help (4 Replies)
Discussion started by: Fundix
4 Replies

2. HP-UX

Recursive copy of Folders with files

Dear All, I will appreciate any help received. Our system is running on hpux v1 My problem is as follows: We have many customer folders with name fd000100, fd000101 and so on e.g. (Testrun)(testsqa):/>ll /TESTrun/fd000100 total 48 drwxrwx--- 2 fq000100 test 96 Jun 27 2004... (17 Replies)
Discussion started by: mhbd
17 Replies

3. Shell Programming and Scripting

Help to move folders, subfolders and files from unix to windows

Hi Unix Gurus, I am able to copy only files that exist in the parent folder. My parent folder has sub folders and within sub folders there are lots files. I need to copy folder, sub folders and files from Unix to the remote windows SFTP location. The directory structure is something like... (1 Reply)
Discussion started by: shankar1dada
1 Replies

4. Shell Programming and Scripting

recursive saving of files and folders

Hi all I have a bash script, that loops through a folders files and all subfolders for .shtml files. It looks for a string and replaces it, creating a backup of the original file. This all works great, but I'd like, when the backup is done, that the files are then also created in their... (4 Replies)
Discussion started by: terrid
4 Replies

5. Windows & DOS: Issues & Discussions

Windows mass copy files with same name in differnt folders

I have files existing with same names in the folders with date as display below c:\2010-09-10 <==== folder arr1.jpg arr2.jpg arr3.jpg arr4.jpg c:\2010-09-09 <==== folder arr1.jpg arr2.jpg c:\2010-09-08 <==== folder arr2.jpg arr3.jpg arr4.jpg ... (5 Replies)
Discussion started by: jville
5 Replies

6. UNIX for Dummies Questions & Answers

Renaming file in Recursive folders

I have UWin version of Unix for Destop I have files with extension *.abc. I want to rename it to *.csv. Some of the filenames have spaces. I also to rename the files with extension *.abc in the corresponding subfolders ex == abc def.abc ghi jkl.abc mnopqr.abc uvwxyz.abc rename as... (4 Replies)
Discussion started by: bobbygsk
4 Replies

7. Windows & DOS: Issues & Discussions

Copy folders and subfolders from unix to windows

Sir From a unix machine some folders and their folders have to be copied to windows XP PC. Please help me with a batch file or a shell script. I am new to the the shell and batch files. Thanks in anticipation. sastry (3 Replies)
Discussion started by: chssastry
3 Replies

8. UNIX for Dummies Questions & Answers

folder replication between windows and unix

1. How do i replicate folders between windows and unix. if i create a subfolder under NDC in windows, it should automatically create a subfolder in unix as well. windows nt /NDC/SUBFOLDERS hp ux /NDC/SUBFOLDERS 2. How do i ftp a file from windows to unix using automated... (0 Replies)
Discussion started by: systemsb
0 Replies

9. HP-UX

HP Unix replication solution

Hi, I looking to setup HP Unix to HP Unix replication as plan of business continuity. The setup can be active passive or active active. Anyone can give me some idea what solution able to perform that? Thanks (3 Replies)
Discussion started by: ufo_999
3 Replies

10. UNIX for Dummies Questions & Answers

Unix System Total Replication

Is there any way to totally replicate a unix system from one hardisk to another? And be able to swap the hardisk and restart the system without any error? TQ (4 Replies)
Discussion started by: nuraman
4 Replies
Login or Register to Ask a Question