Solved

moving files

Posted on 1998-06-03
6
234 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
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 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…
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.

760 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

20 Experts available now in Live!

Get 1:1 Help Now