Solved

moving files

Posted on 1998-06-03
6
245 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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.:
Suggested Courses

636 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