Automatically move or delete files from a folder after x amount of days

Advertisement

jatkins4
Joined:
Posts:
1

Automatically move or delete files from a folder after x amount of days

WinSCP version: 5.13.3
Microsoft windows: Windows 10 version 21H2
Transfer Protocol: SFTP
Use GUI Explorer Interface
Hello, I would like to know if it is possible to automatically move files to a different folder or delete files from a folder. For context, I receive files inside of a folder and have to manually move them after we use them. Is there a code or way to automate that process by saying for example "after x amount of days, move file from this folder into another folder" or "After x amount of days, delete the selected file"?
If there is a way, I have a follow up question. Is there possibly a way to only have the above process move select files and keep other ones in the original folder?
Please let me know, Thanks!

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Automatically move or delete files from a folder after x amount of days

Yes it's possible to write a script to delete/move old files.
A simple example is here:
Batch delete files on FTP older than x days
For more fancy rules, it's better to use PowerShell:
How to delete files older than x days from SFTP server in PowerShell
You will find lot of other examples here on the forum and on Stack Overflow.

Reply with quote

Advertisement

You can post new topics in this forum