How to ignore '.' files | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

How to ignore '.' files

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 09-04-2007
James_UK James_UK is offline
Registered User
 
Join Date: Sep 2007
Last Activity: 9 February 2011, 5:06 AM EST
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
How to ignore '.' files

I'm running Fedora Core 6 as an FTP server on a powerMac G4...

I'm trying to create a script to remove files older than 3 days...
I'm able to find all data older than 3 days but it finds hidden files such as
/home/ftp/goossens/.canna
/home/ftp/goossens/.kde
/home/ftp/goossens/.kde/Autostart/.directory
/home/ftp/goossens/.kde/Autostart/Autorun.desktop

Any ideas how I can find just FTP data?
Sponsored Links
    #2  
Old 09-04-2007
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
Moderator
 
Join Date: Jan 2007
Last Activity: 23 September 2014, 3:49 PM EDT
Location: Варна, България / Milano, Italia
Posts: 5,674
Thanks: 182
Thanked 620 Times in 578 Posts
Use zsh:


Code:
rm -- /home/ftp/**/*(.m+3)

Sponsored Links
    #3  
Old 09-04-2007
James_UK James_UK is offline
Registered User
 
Join Date: Sep 2007
Last Activity: 9 February 2011, 5:06 AM EST
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Bug Jt

Thanks for this... Would you mind explaining the syntax?

Also, if a folder inside /home/ftp becomes older than 3 days, what's stopping it from being deleted? I ask this as all the top level directories within /home/ftp need to remain.
    #4  
Old 09-04-2007
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
Moderator
 
Join Date: Jan 2007
Last Activity: 23 September 2014, 3:49 PM EDT
Location: Варна, България / Milano, Italia
Posts: 5,674
Thanks: 182
Thanked 620 Times in 578 Posts
** matches a path consisting of zero or more directories.
. in (.m+3) matches plain files (NOT directories, nor dotfiles).
m is the file modification time, 3 is the number of days.

For more info: man zshexpn.
Sponsored Links
    #5  
Old 09-06-2007
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
 
Join Date: Mar 2007
Last Activity: 31 August 2014, 7:32 PM EDT
Location: Toronto, Canada
Posts: 2,877
Thanks: 0
Thanked 110 Times in 102 Posts
Quote:
Originally Posted by James_UK View Post
I'm running Fedora Core 6 as an FTP server on a powerMac G4...

I'm trying to create a script to remove files older than 3 days...
I'm able to find all data older than 3 days but it finds hidden files

What "finds hidden files"? If you have attemtped a script, you should post it.
Quote:
such as
/home/ftp/goossens/.canna
/home/ftp/goossens/.kde
/home/ftp/goossens/.kde/Autostart/.directory
/home/ftp/goossens/.kde/Autostart/Autorun.desktop


Code:
## set DIR to the directory you want to search
find "$DIR" ! -name '.*' -mtime +3 -exec rm {} \;

Quote:
Any ideas how I can find just FTP data?

What do you mean by "FTP data"?
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Getting ls to ignore ~ and # files yaroslavvb Shell Programming and Scripting 2 06-13-2011 11:29 AM
How to ignore first or last parameter arturo322 Shell Programming and Scripting 2 02-21-2011 12:21 AM
please ignore this.... ynilesh UNIX for Dummies Questions & Answers 1 08-13-2008 01:31 PM
How to ignore incomplete files sentak Solaris 6 02-14-2008 03:03 PM
How to ignore incomplete files sentak Shell Programming and Scripting 6 02-14-2008 01:29 PM



All times are GMT -4. The time now is 10:23 PM.