-
Notifications
You must be signed in to change notification settings - Fork 87
/
mvs
executable file
·35 lines (32 loc) · 824 Bytes
/
mvs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl
#
# move screenshots into current/argv directory
# add path to clipboard and beep
#
# -samy kamkar
use y;;;
my $pwd = shift || pwd;
my $sspath = shift || screenshot_path();
my $dlpath = shift || download_path();
my %paths = h ($sspath, $dlpath, @ARGV);
map { die "screenshot directory not found: $_\n" unless -d $_ } keys %paths;
print "moving screenshots/images from " . join(" & ", keys %paths) . " into $pwd...\n";
while (my @f = watch_dir(keys %paths))
{
for my $file (@f)
{
my ($fn) = (split(m~/~, $file))[-1];
if ($fn =~ /^(cleanshot|screenshot|img_)/i)
{
my $new = "$pwd/$fn";
print "$file -> $new\n";
copy($new);
beep();
rename($file, $new) or die "failed to move $file to $new: $!\n";
}
else
{
print "ignoring $file\n";
}
}
}