Delete more than one file time unix




















Asked 9 years, 8 months ago. Active 1 year, 5 months ago. Viewed k times. I have this list of files on a Linux server: abc. Improve this question. Matthias Braun By the way, why tthe -rf? Are these folders? It will work if it's only a file but be warned, using -rf each time you want to delete something is very very very very dangerous.

I take no position on the matter, at least not here, and this is not the place to debate it. Add a comment. Active Oldest Votes. Bash supports all sorts of wildcards and expansions. Improve this answer. Don't use "rm" if you wish to restore the files in future. You can use "rm-trash" utility : github.

Very useful, but it is not asking for confirmation to delete. Please be aware. Keith Thompson Keith Thompson k 41 41 gold badges silver badges bronze badges. Andrew Andrew 3, 1 1 gold badge 29 29 silver badges 33 33 bronze badges. This should be the accepted answer as it explicitly answers the posed question. I want to delete anything with Aug I have several files like that. Delete file to day.

Hi My directory structure is as below. Listing the file name and no of records in each files for the files created on a specific day. Hi, I want to display the file names and the record count for the files in the 2nd column for the files created today. Here is what I am trying, but it gives me errors PS : -empty option is not working at my Sun OS version. Thanks, A 6 Replies. Find files of particular day.

Hi, I need to find all files of particular day lets say for 2nd august in below. When a file is removed temporarily by using a graphical user interface, then it is stored in the Trash folder, and it can be restored if required. The file which is removed permanently cannot be restored later normally. If any file is removed accidentally by this command, then it can be restored from the backup.

Active 7 years, 1 month ago. Viewed 3k times. Please advise me how can I achieve this via shell script? Improve this question. Vamsi Krishna Vamsi Krishna 49 2 2 silver badges 8 8 bronze badges. I did some significant cleanup on your question to what I think you were trying to ask. However the only uncertainty I had was in regards to: "The issue here is there is a chance that I might have files received for January 30th so in that case I should not delete the latest file but I have to delete the rest".

Are you meaning to say you might have a file for January 30th, but not January 31st, and so in that case you should preserve the January 30th file? Is the list of file names sorted by date? Try logrotate , it's been created to do that for you without the need of scripts.

Show 2 more comments. Active Oldest Votes. Improve this answer. Hi paulburkeland, this script is also listing the latest file of every month. It shouldn't return it. I believe we need to add one more if condition to find latest file for each month to keep saved. Hi paulburkeland, are you working on my requirement?



0コメント

  • 1000 / 1000