Solved

moving files

Posted on 1998-06-03
6
235 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
llcommand 6 87
EMC VNX  storage pool  Vs  raid group  question 3 120
Parsing a file using ksh 10 57
auto mounter on solaris 1 52
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

920 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

15 Experts available now in Live!

Get 1:1 Help Now