The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Archiving the files Sunitha_edi82 Shell Programming and Scripting 1 08-05-2008 08:50 AM
Archiving by Time aefskysa Shell Programming and Scripting 4 07-18-2008 10:04 AM
Archiving big ammount of files. Maxeg UNIX for Dummies Questions & Answers 3 03-27-2008 04:26 PM
Archiving and moving the files nvuradi Shell Programming and Scripting 1 03-09-2007 08:58 AM
Backing up or Archiving files in UNIX Dsartelle UNIX for Dummies Questions & Answers 2 09-16-2004 04:42 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-18-2008
c00kie88 c00kie88 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 63
Archiving and move files in the same time

Hi All,

I have tried so many command but none work like i wanted.

I would like archive which i assume it will move the files and archive it somewhere.

for example:

if i have a folder and files:
/home/blah/test
/home/blah/hello
/home/blah/foo/bar

i would like to archive folder blah which including the subfolder.
i use gtar -czf backup.tar.gz blah

but it does not actually move the files "test" and "hello" and "bar"

Is there any way to archive specific files inside directory/subdirectory but actually also move the files to the archive file but i would like to keep the dir structure as well?

please help any advise..
  #2 (permalink)  
Old 08-18-2008
Vi-Curious Vi-Curious is offline
Registered User
  
 

Join Date: Jul 2008
Location: Texas
Posts: 129
How about if you try


Code:
 
gtar -czf backup.tar.gz blah/*

Nb: But the files are not moved. The archive will have a copy of the files but they will still exist in /home/blah/...

Last edited by Vi-Curious; 08-18-2008 at 12:52 AM.. Reason: Add comment
  #3 (permalink)  
Old 08-18-2008
c00kie88 c00kie88 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 63
Hi Vi-Curious,

It does the same as
gtar -czf backup.tar.gz blah

it does not move the files in the source but making a copy instead.
  #4 (permalink)  
Old 08-18-2008
Vi-Curious Vi-Curious is offline
Registered User
  
 

Join Date: Jul 2008
Location: Texas
Posts: 129
It is not going to move the files, ever. If you want the files moved, you need to move them. And where do you want them moved to or do you really just want them deleted? I don't think I understand what you want to happen.

As for my previous post, I guess I misunderstood you there as well. I thought you were saying that gtar did not put the files (located in the subdirectory) into the archive file. It should, without the /*, but I thought you were saying it didn't.
  #5 (permalink)  
Old 08-18-2008
c00kie88 c00kie88 is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 63
Ok..

What i'm trying to do is:
I have many files that our company don't use anymore but i need to keep it up to 10 yrs..
What i want is to archive all those files to a separate harddrive/partition.
if i use gtar -czf backup.tar.gz blah, it will give me a copy of those files to different location which i don't want that.
i would like to take all those files away from source to destination but specific files only..
  #6 (permalink)  
Old 08-18-2008
Vi-Curious Vi-Curious is offline
Registered User
  
 

Join Date: Jul 2008
Location: Texas
Posts: 129
I still don't understand your resistance to using the gtar archive. If you have files in some source directory that you want archived and stored in some destination, you can gtar the files to be archived, put the gtar file in the destination, and delete the files from the source directory. By using gtar, you are compressing the archived files so that they don't take as much disk space.

If, however, you really don't want to bother with the compressed archive file, you can just use mv to move the files where you want them.

The main question, then, is how do you identify which files you need to archive? What is the criteria?
  #7 (permalink)  
Old 08-18-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Sorry if I'm stating the obvious here, but GNU tar has an option --remove-files to delete archived files.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:51 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0