Am trying to delete files uploaded 1 hour below, on Dropbox but am getting this error. even tho i have files uploaded below 1 hour ago

No files found from the last hour to delete.

#!/usr/bin/perl use strict; use warnings; use DateTime; use JSON; use WebService::Dropbox; my $Token_id = ''; my $key = ''; my $secret = ''; # Initialize Dropbox client my $dropbox = WebService::Dropbox->new({ key => $key, secret => $secret, }); $dropbox->access_token($Token_id); # Calculate the timestamp from one hour ago my $one_hour_ago = DateTime->now()->subtract(hours => 1); my @files_to_delete; # List files from a specific folder # Use "" for root dir my $result = $dropbox->list_folder({ path => "" }); foreach my $file_metadata (@{ $result->{entries} }) { if ($file_metadata->{'.txt'} eq 'file') { # Parse the file's timestamp my $file_modified_dt = DateTime->from_iso8601($file_metadata-> +{client_modified}); # Check if the file was modified within the last hour if ($file_modified_dt > $one_hour_ago) { push @files_to_delete, $file_metadata->{path_display}; } } } if (@files_to_delete) { # Delete the collected files in a batch $dropbox->delete({ entries => \@files_to_delete }); print "Deleted " . scalar(@files_to_delete) . " files uploaded in +the last hour.\n"; } else { print "No files found from the last hour to delete.\n"; }

In reply to DropBox Delete files by frank1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.