I have made great progress but am stuck with one issue.
I need to delete remote folders with certain conditions. Either can be true, meaning either will work for me.
Delete remote directories that are empty.
or
Delete remote directories that are > than seven days old.
Any help would be great.
Thank you
I need to delete remote folders with certain conditions. Either can be true, meaning either will work for me.
Delete remote directories that are empty.
or
Delete remote directories that are > than seven days old.
Any help would be great.
Thank you
An example is worth thousands of words:
FTP Script
- # This script deletes any remote directory in the first level of directories of the FTP site that is
- # empty or is more than a week old. Use with caution.
- # Get the list of directories in the FTP site (only directories in the root folder)
- # For each directory
- # Get the last modification time
- # Calculate how old is that directory
- # is it older than a week?
- $is_older_than_a_week = "TRUE"
- $is_older_than_a_week = "FALSE"
- # Change current remote path to that directory
- # Get the listing of files and subdirectories
- # If we have successfully retrieved the file and directory listings
- # and the number of items os zero...
- $is_empty = "TRUE"
- $is_empty = "FALSE"
- # return to the FTP site root folder
- # If the directory is older than a week or is empty proceed to remove it
- # Uncomment this if you are sure what you are doing
- # RMDIR($dirname)
liked Script FTP? Try our other product Email Parser