Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

How to ignore '.' files

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 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?Unix or Linux ImageUnix or Linux Image
Sponsored Links
    #2  
Old Unix and Linux 09-04-2007
radoulov's Unix or Linux Image
radoulov radoulov is offline Forum Staff  
Moderator
 
Join Date: Jan 2007
Last Activity: 23 April 2015, 3:05 PM EDT
Location: Варна, България / Milano, Italia
Posts: 5,690
Thanks: 184
Thanked 624 Times in 582 Posts
Use zsh:


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

Sponsored Links
    #3  
Old Unix and Linux 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 Unix and Linux 09-04-2007
radoulov's Unix or Linux Image
radoulov radoulov is offline Forum Staff  
Moderator
 
Join Date: Jan 2007
Last Activity: 23 April 2015, 3:05 PM EDT
Location: Варна, България / Milano, Italia
Posts: 5,690
Thanks: 184
Thanked 624 Times in 582 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 Unix and Linux 09-06-2007
cfajohnson's Unix or Linux Image
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
 
Join Date: Mar 2007
Last Activity: 5 April 2015, 4:53 PM EDT
Location: Toronto, Canada
Posts: 2,882
Thanks: 0
Thanked 117 Times in 106 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 Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image 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 02:16 PM.