Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to the Power Users community on Codidact!

Power Users is a Q&A site for questions about the usage of computer software and hardware. We are still a small site and would like to grow, so please consider joining our community. We are looking forward to your questions and answers; they are the building blocks of a repository of knowledge we are building together.

Post History

60%
+1 −0
Q&A How to automatically select new bulk downloads, and delete downloads deleted months ago?

Write a script to find the old files. Once you have a full treename of a file, it's trivial to delete it. Pretty much any command shell should be able to do this. Here is an example using my scr...

posted 15d ago by Olin Lathrop‭  ·  edited 15d ago by Olin Lathrop‭

Answer
#2: Post edited by user avatar Olin Lathrop‭ · 2025-02-06T17:55:44Z (15 days ago)
  • Write a script to find the old files. Once you have a full treename of a file, it's trivial to delete it. Pretty much any command shell should be able to do this. Here is an example using my scripting language, <a href="http://www.embedinc.com/pic/escr">ESCR</a>:
  • <pre>
  • // SHOWOLD date
  • //
  • // Show all the files in the current tree that are older than DATE. The
  • // format for DATE is YYYY/MM/DD.
  • //
  • var new thdate time = [arg 1]
  • ////////////////////////////////////////////////////////////////////////////////
  • //
  • // Subroutine OLDFILE tnam
  • //
  • // TNAM is the full treename of a file older than the threshold date/time.
  • //
  • subroutine oldfile
  • var local tnam string = [vnl [arg 1]]
  • show "Old file " tnam
  • endsub
  • ////////////////////////////////////////////////////////////////////////////////
  • //
  • // Subroutine DODIR path
  • //
  • subroutine dodir
  • var local olddir string = [dir]
  • loop dir "."
  • pick one by [dent type]
  • option "DIR"
  • dir [dent]
  • call dodir:+1 //process subdirectory recursively
  • dir olddir
  • option "FILE"
  • if [< [dent dtm] thdate] then //older than the threshold ?
  • call oldfile [dent tnam]
  • endif
  • endpick
  • endloop
  • endsub
  • ////////////////////////////////////////////////////////////////////////////////
  • //
  • // Start of main routine.
  • //
  • show "Files older than " thdate ":"
  • call dodir
  • </pre>
  • Since I didn't actually want to delete files on my system, I have it only show the name of each old file. However, you could make subroutine OLDFILE do whatever you wanted, including deleting the file.
  • If you want to run the above script directly, you'll have to install my ESCR scripter. It is included in the Full Runtime release at http://www.embedinc.com/pic/dload.htm.
  • Again, similar things can be done with other scripting languages and most command shells.
  • Write a script to find the old files. Once you have a full treename of a file, it's trivial to delete it. Pretty much any command shell should be able to do this. Here is an example using my scripting language, <a href="http://www.embedinc.com/pic/escr">ESCR</a>:
  • <pre>
  • // SHOWOLD date
  • //
  • // Show all the files in the current tree that are older than DATE. The
  • // format for DATE is YYYY/MM/DD.
  • //
  • var new thdate time = [arg 1]
  • ////////////////////////////////////////////////////////////////////////////////
  • //
  • // Subroutine OLDFILE tnam
  • //
  • // TNAM is the full treename of a file older than the threshold date/time.
  • //
  • subroutine oldfile
  • var local tnam string = [vnl [arg 1]]
  • show "Old file " tnam
  • endsub
  • ////////////////////////////////////////////////////////////////////////////////
  • //
  • // Subroutine DODIR
  • //
  • // Process all the files in the current directory and any of its
  • // sub-directories.
  • //
  • subroutine dodir
  • var local olddir string = [dir]
  • loop dir "."
  • pick one by [dent type]
  • option "DIR"
  • dir [dent]
  • call dodir:+1 //process subdirectory recursively
  • dir olddir
  • option "FILE"
  • if [< [dent dtm] thdate] then //older than the threshold ?
  • call oldfile [dent tnam]
  • endif
  • endpick
  • endloop
  • endsub
  • ////////////////////////////////////////////////////////////////////////////////
  • //
  • // Start of main routine.
  • //
  • show "Files older than " thdate ":"
  • call dodir
  • </pre>
  • Since I didn't actually want to delete files on my system, I have it only show the name of each old file. However, you could make subroutine OLDFILE do whatever you wanted, including deleting the file.
  • If you want to run the above script directly, you'll have to install my ESCR scripter. It is included in the Full Runtime release at http://www.embedinc.com/pic/dload.htm.
  • Again, similar things can be done with other scripting languages and most command shells.
#1: Initial revision by user avatar Olin Lathrop‭ · 2025-02-06T17:51:39Z (15 days ago)
Write a script to find the old files.  Once you have a full treename of a file, it's trivial to delete it.  Pretty much any command shell should be able to do this.  Here is an example using my scripting language, <a href="http://www.embedinc.com/pic/escr">ESCR</a>:

<pre>
//   SHOWOLD date
//
//   Show all the files in the current tree that are older than DATE.  The
//   format for DATE is YYYY/MM/DD.
//
var new thdate time = [arg 1]

////////////////////////////////////////////////////////////////////////////////
//
//   Subroutine OLDFILE tnam
//
//   TNAM is the full treename of a file older than the threshold date/time.
//
subroutine oldfile
  var local tnam string = [vnl [arg 1]]

  show "Old file " tnam

  endsub

////////////////////////////////////////////////////////////////////////////////
//
//   Subroutine DODIR path
//
subroutine dodir
  var local olddir string = [dir]

  loop dir "."
    pick one by [dent type]
      option "DIR"
        dir [dent]
        call dodir:+1        //process subdirectory recursively
        dir olddir
      option "FILE"
        if [< [dent dtm] thdate] then //older than the threshold ?
          call oldfile [dent tnam]
          endif
      endpick
    endloop

  endsub

////////////////////////////////////////////////////////////////////////////////
//
//   Start of main routine.
//
show "Files older than " thdate ":"

call dodir
</pre>

Since I didn't actually want to delete files on my system, I have it only show the name of each old file.  However, you could make subroutine OLDFILE do whatever you wanted, including deleting the file.

If you want to run the above script directly, you'll have to install my ESCR scripter.  It is included in the Full Runtime release at http://www.embedinc.com/pic/dload.htm.

Again, similar things can be done with other scripting languages and most command shells.