Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

moving files

Posted on 1998-06-03
6
Medium Priority
?
246 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 600 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

705 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