1
0
Fork 0

trash script bugfix

This commit is contained in:
Luca Bilke 2024-02-26 23:30:11 +01:00
parent c7191d69f6
commit 5cf5a09bed
2 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ sub trash_dirs ($file_fs_root) {
sub target_file_name ( $file_name, $trash_file_path ) {
opendir( my $dir, "$trash_file_path" ) or die "$!";
my $existing_suffix_nums =
map( ( $_ =~ /^${file_name}\.~(\d)~/ ), readdir $dir );
map( ( $_ =~ /^${file_name}\.~(\d+)~/ ), readdir $dir );
my $suffix_num = max($existing_suffix_nums) + 1;
my $suffix = "~" . $suffix_num . "~";
closedir($dir);

View File

@ -22,7 +22,7 @@ sub trashed_files ( $search_path, $trash_path ) {
my @ret;
opendir( my $dir, "$trash_path/info" ) or die "$!\n";
for ( readdir $dir ) {
$_ =~ /\.~\d~$/ or next;
$_ =~ /\.~\d+~$/ or next;
open( FH, "<", "$trash_path/info/$_" ) or next;
<FH> eq "[Trash Info]\n" or next;
my ( $name, $path, $suffix ) =