Delete file in unix by date




















And i want to delete files for date May Code :. Join Date: Feb Not the file name. I am looking for the Unix file time and date. Join Date: Jul One way: Code :. Thanks agama. Any simpler way to do? Maybe, but more room for error: Code :. Join Date: Mar Code :. Last edited by eosbuddy; at AM..

Shell Programming and Scripting. Delete all files if another files in the same directory has a matching occurrence of a specific word. Delete log files content older than 30 days and append the lastest date log file date. To delete log files content older than 30 days and append the lastest date log file date in the respective logs I want to write a shell script that deletes all log files content older than 30 days and append the lastest log file date in the respective logs This is my script cd Delete file with specific date.

Steve88 Steve88 2, 3 3 gold badges 21 21 silver badges 42 42 bronze badges. Did you have a look at man date? Do you need to delete based on the filename or the file's modification time? Add a comment. Active Oldest Votes. Remove it to test your find filter before executing the whole command And take care that. Improve this answer. Gilles Quenot Gilles Quenot k 33 33 gold badges silver badges bronze badges. It depends of the date of the modification, like what ls -l displays.

Are the date the same as ls -l? Be VERY careful to supply an absolute path on commands like these! Once, using a command very much like this in a cron job, I accidentally deleted every file on my production mail server older than 10 days, which I can tell you was no fun to recover from.

DSimon Thanks for sharing your horror story to help us avoid our own! I had a few directories to do this to, so inspired by your comment, inside my for a in Show 5 more comments. McCready B. McCready 46 4 4 bronze badges. Show 1 more comment. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses. Featured on Meta.

New post summary designs on greatest hits now, everywhere else eventually. Chinmoy Chaudhuri Posted November 13, 0 Comments. AnuradhaDasari Posted November 14, 0 Comments. Thank you. Register or Login. Welcome back! Sign in with Email. Reset Your Password We'll send an email with a link to reset your password.

Stay ahead! Get the latest news, expert insights and market research, tailored to your interests. Sign up with Email.



0コメント

  • 1000 / 1000