ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    File Deletion after x amount of time CentOS 7

    Scheduled Pinned Locked Moved Water Closet
    34 Posts 8 Posters 2.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      First question of course is... what operating system?

      wirestyle22W 1 Reply Last reply Reply Quote 0
      • wirestyle22W
        wirestyle22 @scottalanmiller
        last edited by

        @scottalanmiller CentOS 7

        scottalanmillerS 1 Reply Last reply Reply Quote 0
        • DustinB3403D
          DustinB3403
          last edited by

          From the file level its self, likely not.

          1 Reply Last reply Reply Quote 0
          • GreyG
            Grey
            last edited by

            cron rm

            DustinB3403D scottalanmillerS 2 Replies Last reply Reply Quote 3
            • scottalanmillerS
              scottalanmiller @wirestyle22
              last edited by

              @wirestyle22 said in How to Make a File Self Delete or Time Bomb:

              @scottalanmiller CentOS 7

              Would not have guessed that at all! Normally with no other info we assume Windows. CentOS makes it easy.

              thwrT 1 Reply Last reply Reply Quote 0
              • DustinB3403D
                DustinB3403 @Grey
                last edited by

                @Grey said in How to Make a File Self Delete or Time Bomb:

                cron rm

                Yeah but you'd have to be careful 🙂

                wirestyle22W GreyG 2 Replies Last reply Reply Quote 0
                • scottalanmillerS
                  scottalanmiller @Grey
                  last edited by

                  @Grey said in How to Make a File Self Delete or Time Bomb:

                  cron rm

                  Yup, that's how you do it. Make a cron job to check whatever file(s) or folder(s) you want and delete whatever matches the criteria at whatever age you desire.

                  1 Reply Last reply Reply Quote 0
                  • wirestyle22W
                    wirestyle22 @DustinB3403
                    last edited by

                    @DustinB3403 said in How to Make a File Self Delete or Time Bomb:

                    @Grey said in How to Make a File Self Delete or Time Bomb:

                    cron rm

                    Yeah but you'd have to be careful 🙂

                    This is not a time crunch situation so I have as much time as I want to test it thoroughly

                    1 Reply Last reply Reply Quote 0
                    • GreyG
                      Grey @DustinB3403
                      last edited by

                      @DustinB3403 said in How to Make a File Self Delete or Time Bomb:

                      @Grey said in How to Make a File Self Delete or Time Bomb:

                      cron rm

                      Yeah but you'd have to be careful 🙂

                      rm -rf /

                      1 Reply Last reply Reply Quote 0
                      • wirestyle22W
                        wirestyle22
                        last edited by

                        Hm. I'm going to try to get my auto-renew setup for certbot/letsencrypt through cron and then I guess I'll try to crack this. Good to know it's possible.

                        1 Reply Last reply Reply Quote 0
                        • GreyG
                          Grey
                          last edited by

                          find /path/to/files -mtime +5 -exec rm {} ;*
                          That line would delete files older than the specified number of days.

                          wirestyle22W 1 Reply Last reply Reply Quote 2
                          • wirestyle22W
                            wirestyle22 @Grey
                            last edited by

                            @Grey said in How to Make a File Self Delete or Time Bomb:

                            find /path/to/files -mtime +5 -exec rm {} ;*
                            That line would delete files older than the specified number of days.

                            Very helpful. Thank you.

                            GreyG 1 Reply Last reply Reply Quote 0
                            • GreyG
                              Grey @wirestyle22
                              last edited by

                              @wirestyle22 said in How to Make a File Self Delete or Time Bomb:

                              @Grey said in How to Make a File Self Delete or Time Bomb:

                              find /path/to/files -mtime +5 -exec rm {} ;*
                              That line would delete files older than the specified number of days.

                              Very helpful. Thank you.

                              No worries. Had to mine my twitter account to find it. 😄

                              1 Reply Last reply Reply Quote 1
                              • wirestyle22W
                                wirestyle22
                                last edited by

                                Our users have no idea how to maintain a file server or use things for their intended purpose so I want to establish a policy immediately when this thing goes live so if their files are deleted it's their own problem

                                GreyG scottalanmillerS DashrenderD 3 Replies Last reply Reply Quote 0
                                • GreyG
                                  Grey @wirestyle22
                                  last edited by

                                  @wirestyle22 said in How to Make a File Self Delete or Time Bomb:

                                  Our users have no idea how to maintain a file server or use things for their intended purpose so I want to establish a policy immediately when this thing goes live so if their files are deleted it's their own problem

                                  Here's how to do the same thing in powershell: http://www.networknet.nl/apps/wp/published/powershell-delete-files-older-than-x-days

                                  1 Reply Last reply Reply Quote 2
                                  • scottalanmillerS
                                    scottalanmiller @wirestyle22
                                    last edited by

                                    @wirestyle22 said in How to Make a File Self Delete or Time Bomb:

                                    Our users have no idea how to maintain a file server or use things for their intended purpose so I want to establish a policy immediately when this thing goes live so if their files are deleted it's their own problem

                                    You could, instead. secretly archive the files and store them someplace offline so that they THINK that they deleted them.

                                    GreyG wirestyle22W 2 Replies Last reply Reply Quote 3
                                    • GreyG
                                      Grey @scottalanmiller
                                      last edited by

                                      @scottalanmiller said in How to Make a File Self Delete or Time Bomb:

                                      @wirestyle22 said in How to Make a File Self Delete or Time Bomb:

                                      Our users have no idea how to maintain a file server or use things for their intended purpose so I want to establish a policy immediately when this thing goes live so if their files are deleted it's their own problem

                                      You could, instead. secretly archive the files and store them someplace offline so that they THINK that they deleted them.

                                      I see you're a graduate from the Hillary Clinton School of Technology.

                                      1 Reply Last reply Reply Quote 2
                                      • wirestyle22W
                                        wirestyle22 @scottalanmiller
                                        last edited by

                                        @scottalanmiller said in How to Make a File Self Delete or Time Bomb:

                                        @wirestyle22 said in How to Make a File Self Delete or Time Bomb:

                                        Our users have no idea how to maintain a file server or use things for their intended purpose so I want to establish a policy immediately when this thing goes live so if their files are deleted it's their own problem

                                        You could, instead. secretly archive the files and store them someplace offline so that they THINK that they deleted them.

                                        Nah
                                        eaQvGdK.gif

                                        scottalanmillerS 1 Reply Last reply Reply Quote 0
                                        • scottalanmillerS
                                          scottalanmiller @wirestyle22
                                          last edited by

                                          @wirestyle22 said in How to Make a File Self Delete or Time Bomb:

                                          @scottalanmiller said in How to Make a File Self Delete or Time Bomb:

                                          @wirestyle22 said in How to Make a File Self Delete or Time Bomb:

                                          Our users have no idea how to maintain a file server or use things for their intended purpose so I want to establish a policy immediately when this thing goes live so if their files are deleted it's their own problem

                                          You could, instead. secretly archive the files and store them someplace offline so that they THINK that they deleted them.

                                          Nah
                                          eaQvGdK.gif

                                          Just be aware, if YOU delete files and something important is lost and you aren't 100% clear that there is a policy for this protecting you from management telling YOU that you can delete files, you could be on the hook legally. I would never do this unless told to, in writing, explicitly by management.

                                          1 Reply Last reply Reply Quote 3
                                          • scottalanmillerS
                                            scottalanmiller
                                            last edited by

                                            Even if there is a policy that the users are supposed to clean up files, unless there is also a policy that says that IT is tasked to enforce this through forced deletion, I would stay away from this completely. There is a huge different between "users are supposed to clean things up" and "IT has decided to start deleting things." Never take enforcement into your own hands.

                                            DustinB3403D 1 Reply Last reply Reply Quote 3
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post