ITEM: Q7040L

How to use doswrite to copy an AIX subdirectory tree


Env: 

 AIX 3.2.5

Desc: 

 The customer wants to transfer over a hundred files from AIX 
 to DOS.  She has tried to use doswrite, but it only works for 
 one file, then it stops.  She would like to maintain the entire
 directory hierarchy.  Is there a way to quickly accomplish this?
 I do not have PC Simulator and network file transfer is not an
 option.

Action: 

 Here is a way to move an AIX subdirectory tree to DOS.  
 Unfortunately, this is a multi-stepped procedure, since the 
 doswrite and dosread commands were not designed to create 
 directories...  

 You will need two scripts to perform this procedure: dosdirs
 and dosfiles.

 dosdirs:

 \#!/bin/ksh
 find $1 -type d -print > tmp.$$
 while read i
 do 
   print -n "mkdir a:"
   print $i | sed "s/\\//\\\\\\/g"
 done \< tmp.$$
 rm tmp.$$

 dosfiles:

 \#!/bin/ksh
 find $1 -type f -print > tmp.$$
 while read i
 do
   print -n "$i...  "
   doswrite -a $i $i
 done \< tmp.$$
 rm tmp.$$

 In this example, I demonstrate how to copy /home/liz to a DOS 
 diskette:

 First, change directories to the directory just above the 
 subdirectory tree you would like to copy to DOS:

  cd /home

 Run the following:

  dosdirs liz > doscript.bat

 This will create a DOS bat script called doscript.bat in your 
 current directory.  You will then need to copy the bat script to 
 your DOS diskette:

  doswrite -a doscript.bat doscript.bat

 Take the DOS diskette to your DOS machine and run the following
 commands:

  a:
  doscript.bat

 This will build all of the appropriate directories to copy the 
 files in your subdirectory tree to the diskette.

 Next, carry your diskette back to the AIX machine.

 Run the following:

  dosfiles liz

 This will doswrite all of the files in the subdirectory tree to 
 the DOS diskette.  Please note that the dosfiles script uses the 
 -a flag which will replace all NLs with a CR-LF.  If these are not 
 text files, then you will want to eliminate the -a flag.

 I tested this procedure and it worked fine.  Please note that 
 these scripts are meant to be examples only and may need to be 
 modified if you have different needs that were not addressed 
 specifically by these scripts.  Also, please note that these 
 scripts assume that the entire subdirectory structure and all 
 of its files will fit on one DOS diskette.


Support Line: How to use doswrite to copy an AIX subdirectory tree ITEM: Q7040L
Dated: January 1995 Category: N/A
This HTML file was generated 99/06/24~13:30:37
Comments or suggestions? Contact us