4
votes
4answers
146 views

Keeping the number of files in the folder constant by deleting old files

I'm trying to create a script and run it in crontab every 5 min, so that the number of files in a folder always remain 50000. If there are more, I want the script to delete the old files. ...
3
votes
2answers
1k views

Scripting `rm` and `rm -i`

I want to create a script that whenever there are more than three files being removed, it invokes rm -i by default. I know it will go in initialization files but can't seem to get it working. So far: ...
0
votes
1answer
574 views

Shell script to delete all files which are older [duplicate]

Possible Duplicate: Deleting files by age Write a shell script to delete all the files which are "n" of older that current day, where n can be 3days. 2days, or 1 year etc. The above script ...
0
votes
2answers
1k views

Deleting many files except one type [duplicate]

Possible Duplicate: Deleting all files in a folder except files X, Y, and Z I am writing a script to compile many .tex files. After that, many auxiliaries files were created. So, I would ...
5
votes
2answers
194 views

Is it safe to remove a script file from within that script?

Imagine I have a script foo. It should be run once when the user logs in and isn't needed after a successful run. My question: Is it safe to remove the script file from within the script? E.g.: ...