Solved

moving files

Posted on 1998-06-03
6
236 Views
Last Modified: 2010-04-21
I have two filesystems that are similar in hierarchy only named differently. The structure looks as follows:

/mount1/big/[A-Z]/[A-Z]/[A-Z]/uniquename.big
/mount1/med/[A-Z]/[A-Z]/[A-Z]/uniquename.med
/mount1/sml/[A-Z]/[A-Z]/[A-Z]/uniquename.sml

/mount2/big/[A-Z]/[A-Z]/[A-Z]/uniquename.big
/mount2/med/[A-Z]/[A-Z]/[A-Z]/uniquename.med
/mount2/sml/[A-Z]/[A-Z]/[A-Z]/uniquename.sml

The unique name in an 8.3 format where the last 3 of the eight is the last three letters of the hierarchy.

ie.

/mount1/big/F/G/W/AAABGFGW.big
                       ---

My only point here is that the files are absolutely unique.

I want to move all of the files from /mount2 to mount1 and maintain both the timestamp of the file, hence the move vs copy, and also have them land in the correct directory if it exists, and create the directory if it doesn't exist. When I tried a mv command, for those directories that existed, the system simply went down another level until it didn't find a directory with that name and began creating them at that level. This is not what I want. I simply want to move the files and directories to the filesystem and maintain only three levels of ALPHA character directories under the BIG MED and SML directory.

I hope that this is enough info, if not, ask away.

Thanx in advance
Angel
0
Comment
Question by:airborne
  • 3
  • 2
6 Comments
 

Author Comment

by:airborne
ID: 2007335
Edited text of question
0
 
LVL 3

Expert Comment

by:rickyr
ID: 2007336
Hi...

# ufsdump 0ufc /dev/rmt/1lbn /mount2
# umount /mount2
# mv /mount1 /mount2
# cd /
# ufsrestore rvf /dev/rmt/1lbn .
# mv /mount2 /mount1
Specify next volume #: 1
set owner mode [yn] n
#rm restoresymtable

This is for Solaris, you do not say which OS you use
As for the timestamp, dunno.
regards
0
 
LVL 3

Expert Comment

by:rickyr
ID: 2007337
Woops...
Do line 6 last of all
rickyr
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Author Comment

by:airborne
ID: 2007338
I am running AIX 4.2.1.
I currently have data on both /mount1 and /mount2. so I don't want to unmount one to get to the other. We just upgraded our OS and can now have filesystems that exceed 2Gig in size. I have a complete 32Gig raid broken into 2Gig chunks and I want to consolidate them. This is the reason for the question.
0
 
LVL 2

Accepted Solution

by:
bertvermeerbergen earned 150 total points
ID: 2007339
You can use tar to copy a tree structure like this:

cd /mount2
tar cf - * | (cd /mount1; tar xvf -)

The first tar will write all files, recursing into all subdirectories, to stdout in 'tar' format.  The stdout is redirected through a pipe and taken as input of another tar command that will extract the files, creating subdirectories when needed and keeping modification times.  The second tar runs with the new directory made current, so the tree that was relative to /mount2 will be recreated under /mount1.
Remark that on some systems, an option is required to avoid a 'Broken pipe' when using tar like this.  Your man pages can tell you more if you run into this problem.

Another solution is the use of 'cpio -p ...', also called pass-mode.  This is more flexible but you will need to use an additional 'find' command to create a list of all the files you want to copy and feed this list to cpio.  In the case you describe, the additional flexibility is not required.  A lot of options exist for cpio, see the man page for a description on your system if the tar solution does not work for you.
0
 

Author Comment

by:airborne
ID: 2007340
You are the Man! Have my Bud Light!

Thanx a bunch
A
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now