Hello, I need a script to delete files older than 3 monthes from a specific folder (different folders). I suppose it' relatively simple but it will take me hours to find how to manage this so I prefer to ask first.
Thanks for any help.
delete old file from specific folder
delete old file from specific folder
Windows 10 64 bits
Re: delete old file from specific folder
This one works recursively. If you don't want that, use /fn instead of just /f.
Code: Select all
$folders = <<<>>>
D:\Users\Name1
D:\Temp
<another folder...>
>>>;
foreach($folder, $folders, <crlf>, "e") {
if (exists($folder) != 2) { continue; }
delete 1, 0, quicksearch("ageC: > 3 m /f", $folder , "|");
}
One of my scripts helped you out? Please donate via Paypal
Re: delete old file from specific folder
Thanks a lot. I must admit I may have succeed but it would not be so efficient.
is surprising to me.
Code: Select all
$folders = <<<>>>
D:\Users\Name1
D:\Temp
<another folder...>
>>>;
Windows 10 64 bits
Re: delete old file from specific folder
Hello, I try to delete only .eml files from a directory and it does not seem to work
Code: Select all
foreach($folder, $folders, <crlf>, "e") {
if (exists($folder) != 2) { continue; }
delete 1, 0, quicksearch("ageC: > 3 m AND *.eml /fr", $folder , "|");
}
Windows 10 64 bits
Re: delete old file from specific folder
You need to use
otherwise *.eml is interpreted as ageC:*.eml and not as name:*.eml
The first ageC is so called "propagated" to every other pattern behind it,
until name: is used here
Code: Select all
delete 1, 0, quicksearch("ageC: > 3 m AND name:*.eml /fr", $folder , "|");
The first ageC is so called "propagated" to every other pattern behind it,
until name: is used here
One of my scripts helped you out? Please donate via Paypal
Re: delete old file from specific folder
Thanks. I suspected somethihg like this but the example in documentation did not show name:highend wrote:You need to use
otherwise *.eml is interpreted as ageC:*.eml and not as name:*.emlCode: Select all
delete 1, 0, quicksearch("ageC: > 3 m AND name:*.eml /fr", $folder , "|");
The first ageC is so called "propagated" to every other pattern behind it,
until name: is used here
Windows 10 64 bits
Re: delete old file from specific folder
Look into
Main Topics - Info Panel - Find Files Tab
under
Field Type Inheritance
There you can find that explanation of propagated types
Main Topics - Info Panel - Find Files Tab
under
Field Type Inheritance
There you can find that explanation of propagated types
One of my scripts helped you out? Please donate via Paypal
Re: delete old file from specific folder
Thanks for the information.highend wrote:Look into
Main Topics - Info Panel - Find Files Tab
under
Field Type Inheritance
There you can find that explanation of propagated types
Windows 10 64 bits