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
unix questions ccp UNIX for Dummies Questions & Answers 4 07-22-2008 08:51 AM
some questions about UNIX 5.0.6 , Help me please mrr53 SCO 2 10-27-2007 03:53 AM
New To Unix - Some Questions! yahoo14 UNIX for Dummies Questions & Answers 1 06-08-2006 02:43 AM
Some UNIX Questions! JoeTheMan UNIX for Dummies Questions & Answers 1 01-19-2006 01:30 AM
I have a few questions about Unix.. SolidWing68 UNIX for Dummies Questions & Answers 1 08-11-2005 06:22 AM

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 10-19-2007
kaka kaka is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 6
2 Unix questions

If I wanted to do the following things to all the files in a directory how could I do it. Make all the files in a directory and in its sub directories to hidden status and make a different directory and all its sub directories copy inhibit. I am really stumped and have been looking through the internet for the answer and no luck so far. I was thinking chmod but I think that is incorrect so please help me.
  #2 (permalink)  
Old 10-19-2007
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,957
to make a file as a hidden file, it should be renamed with the "." in the front

filename : abc.txt
changed to : .abc.txt
  #3 (permalink)  
Old 10-19-2007
kaka kaka is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 6
so how would i go about renaming all the files in a directory and its sub dirctories to the same names with a . in front of them????
like a mv -R * .* or something so all the files keep there original name and just add a . infront????

Last edited by kaka; 10-19-2007 at 06:36 PM..
  #4 (permalink)  
Old 10-19-2007
porter porter is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 2,965
you would need to do something like


Code:
find PRIVATE -type f | while read N
    dir=`dirname $N`
    base=`basename $N`
    mv $N ${dir}/.${base}
done
I suggest you play around with the idea.

By the way, why not just make the directory 0700?

Also, simply making something hidden does not stop people reading it.
  #5 (permalink)  
Old 10-20-2007
swat swat is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 24
Ya porter you are right...
Better to use chmod....coz hiding file using . is not good solution ....


Thanks,
SWatantra
  #6 (permalink)  
Old 10-20-2007
kaka kaka is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 6
find PRIVATE -type f | while read N
dir=`dirname $N`
base=`basename $N`
mv $N ${dir}/.${base}
done



I am new to unix can you explain that code? Does it do this:

my Main directory is name in name is a file and a sub directory with a name like jon in that is a file will that code rename all of the files under it to hidden
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 08:38 AM.


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