| Server IP : 138.197.107.151 / Your IP : 216.73.217.10 Web Server : Apache/2.4.58 (Ubuntu) System : Linux BloxBy-Builder 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : wpbetasites_mrakzqskir ( 1022) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/bsd-crawler-parser/sweep/ |
Upload File : |
import boto3
s3 = boto3.client("s3")
SRC = "bsd-wpe-logs"
DST = "bsd-wpe-logs-private"
PREFIX = "logs/"
def lambda_handler(event, context):
paginator = s3.get_paginator("list_objects_v2")
moved = 0
for page in paginator.paginate(Bucket=SRC, Prefix=PREFIX):
for obj in page.get("Contents", []):
key = obj["Key"]
if key.endswith(".largefs") or key.endswith("/"):
continue
s3.copy_object(
Bucket=DST,
Key=key,
CopySource={"Bucket": SRC, "Key": key},
)
s3.delete_object(Bucket=SRC, Key=key)
moved += 1
print(f"Moved {moved} objects")
return {"moved": moved}