Note that there are some explanatory texts on larger screens.

plurals
  1. POEasy way of moving directories containing old files away
    primarykey
    data
    text
    <p>I maintain a lot (ca 1000) of customers' folders in paths /home/customers/customer1, /home/customers/customer2,... etc. Now customers come and go, and I don't want to keep folders which were not modified for some time (e.g. 2 years) in my working drive.</p> <p>What I need, is a simple script that would </p> <p>a) take all candidate folders as immediate (i.e. without recursion to sub-folders, as I don't want to split customer's data) descendants of a given path (e.g. /home/customers/);</p> <p>b) for each folder compute the most recent modification time;</p> <p>c) if the modification time for some folder (e.g. /home/customers/mycustomer231) is older than, say, 1 year, move it to specified path (e.g. /var/backup/oldcustomers).</p> <p>What is the simplest way of implementing it? </p> <p>In what language? In Bash? Perl? Python? Some other language?</p> <p>I know some basics of Bash. I know, that there is a way of achieving it by nesting one <code>find &lt;..&gt; -exec</code> inside another and using advice from <a href="https://stackoverflow.com/questions/4997242/in-linux-terminal-how-do-i-show-the-folders-last-modification-date-taking-its">this thread</a>, but the resulting code surely would not look easy to understand and maintain. I also know some basics of the other mentioned languages, enough to understand most of their code, but without enough experience to write my own solution.</p> <p><em>(Yes, I could spend month+ learning one of those languages, but for solving my isolated problem the price in time is too dear. I'm sure, that the problem is basic and people who professionaly work with lot of users in /home/ and were purging old entries, already have solution for it.)</em></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload