View Full Version : Delete files by date
Shark
08-09-2014, 05:12 AM
Hello,
I would like to keep a remote folder with 30 days worth of files.
Anything older than that, I would like to delete. I can run task every day or so to go in and delete the old files.
I was wondering if there was a way I could do this with FlashFXP or if anyone had any ideas?
Thanks.
bigstar
08-09-2014, 11:17 AM
Using the latest FlashFXP v5.0 release (https://oss.azurewebsites.net/download-beta) you can do this with custom commands.
/select -f :age+30dThis instructs FlashFXP to select only files with a date/time older than 30 or more days.
Now to make this into a queue entry we can enqueue raw commands by right-clicking the file list and selecting enqueue > raw command from the popup menu.
The whole process is as followed:
1. Connect to the site where you want to perform this operation.
2. Enqueue the following as a single raw command.
(Click the down triangle on the raw command dialog to switch to multi-line mode)
/cd /folder/you/want/to/delete/from
/select -f :age+30d
/delete selected
3. Save the queue to a file.
Additional Information
The multi-line toggle button on the raw dialog was added in v5.0.0.3756
The reason we're doing this as a single raw command is because we want to abort the command block if the first command (/cd <path>) fails.
Shark
08-09-2014, 05:03 PM
Hi bigstar,
Thanks for the quick reply. I hope has been good.
I am just playing around with the commands now, I noticed that it selected them strange (see attached shot).
Then I was thinking, it may be because the date displayed is "Date Modified" which isn't the actual file date. Then I tried to change it to the real file date, but, there is not the option?
Is there any way I can do that?
Hopefully once I get this done I can set it up as a queue to do it every week via task scheduler.
PS. Your installer does not have a back button. Only next or cancel!
http://clan-tea.com/temp/selection.jpg
Shark
08-09-2014, 06:14 PM
Would the command line for task scheduler be:
FLASHFXP.EXE -c2 -go deletefiles.fqf
bigstar
08-09-2014, 08:03 PM
This feature was intended to work with the modified date which is supported by all servers, some servers are capable of providing the created date but currently we don't support this field.
There is a back button for some sections of the installer, its located at the top of the window on the glass caption bar and its a round (<-) arrow button.
If you want to configure windows scheduler directly that will work, but you can also configure it directly within FlashFXP under Tools > Schedule, select the queue file and set the desired schedule, you can even setup an email notification on failure with logs.
As for the selection looking a bit odd, can you sort the list by modified date and verify if everything looks right? I did some selection tests and from what I am seeing everything appears to be working correctly.
Shark
08-09-2014, 10:15 PM
Ah ok, I see what you mean... I wasn't sorted by date. Will test it again with 29 days later today and let you know.
In regards to the FFXP Schedule, does FFXP have to be running though?
Shark
08-09-2014, 10:47 PM
I just checked the help and realised it adds to the Windows Task. Thanks again.
Shark
08-10-2014, 01:02 AM
Also, those commands you have listed above:
/select -f :age+30d
/delete selected
Where are they all written if I want to have a look?
bigstar
08-10-2014, 08:34 AM
The help file for v5.0 is currently work in progress so you will not find everything listed
Help file > Reference >Custom Commands
You can fill in the blanks by reading over the following thread which lists many of the changes
https://oss.azurewebsites.net/forum/flashfxp/custom-commands/16296-request-custom-command-suggestions.html
(https://oss.azurewebsites.net/forum/flashfxp/custom-commands/16296-request-custom-command-suggestions.html)(However I am not sure if everything on that thread is 100% accurate, some commands may have been modified/tweaked since my original posting)
Shark
08-10-2014, 08:00 PM
Great, thanks.
vBulletin® v3.8.11 Alpha 3, Copyright ©2000-2024, vBulletin Solutions, Inc.