LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-12-2011, 07:30 PM   #16
xjx424
LQ Newbie
 
Registered: Apr 2011
Posts: 15

Original Poster
Rep: Reputation: 0

Ahhhh! I guess that would make sense. OK, switching the two now and trying, still not working but at least I have a chance now!
 
Old 04-12-2011, 08:54 PM   #17
xjx424
LQ Newbie
 
Registered: Apr 2011
Posts: 15

Original Poster
Rep: Reputation: 0
Still stuck!

If I use this
Code:
tar -zcvf "$al".tar.gz "$al"
I get the correctly named tar.gz file in the correct location...but when untar'ed it contains the folders and absolute path to the file

If I use this
Code:
tar -zcvf "$al".tar.gz "$(basename "$al")"
I get "Cannot stat: No such file or directory"

I don't understand how to point to just the folder which is "$(basename "$al")" and still include the full path as in the variable $al
 
Old 04-13-2011, 12:38 PM   #18
xjx424
LQ Newbie
 
Registered: Apr 2011
Posts: 15

Original Poster
Rep: Reputation: 0
Finally got it!

Code:
cd /var/www/hfandt.com/artists/
for dirname in */;
do
	cd /var/www/hfandt.com/artists/"$dirname"/
	for al in *;
		do
			tar -zcvf "$al".tar.gz "$al"
		done
done
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the path for QCAD folder in Ubuntu? coss_cat Linux - Software 3 03-29-2011 03:22 PM
Add folder to perl path sir-lancealot Programming 1 06-08-2010 01:36 PM
Path to a share folder, how??? lefaman72 SUSE / openSUSE 4 02-26-2010 05:32 AM
How do you address a folder in another path Redbug Linux - Newbie 1 08-27-2008 12:06 PM
Cant move a folder to another path? dwarf007 Linux - Newbie 2 09-19-2004 03:28 AM


All times are GMT -5. The time now is 11:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration