1

FTPRush Cleanup Script


Posted by Artem Russakovskii on October 28th, 2007 in Programming
Share

Updated: May 23rd, 2009

Removes all ftprush queue items that don't download to localhost. It is useful to run if you FXP a lot of files back and forth and want to clean up the queues from time to time, but don't want to delete anything that is downloading. Feel free to make a shortcut to this script and run it any time you want.

Note that this script is only compatible with the ANSI FTPRush version. The Unicode version is not supported.

You need to have Activestate Perl installed in order to run this script. http://www.google.com/search?q=activestate+perl+download

Script source is available from SVN here.

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/perl
#
# AUTHOR:   Artem Russakovskii
#
# URL:      http://beerpla.net
#
# DATE:     02/21/07
#
# ABSTRACT: Removes all ftprush queue items that don't download to localhost.
#           It is useful to run if you FXP a lot of files back and forth and want
#           to clean up the queues from time to time, but don't want to delete
#           anything that is downloading.
#           Feel free to make a shortcut to this script and run it any time you want.
#
#           Note that this script is only compatible with the ANSI FTPRush version.
#           The Unicode version is not supported.
#
#           You need to have Activestate Perl installed in order to run this script.
#           http://www.google.com/search?q=activestate+perl+download
 
use strict;
use Data::Dumper;
use File::Path;
use File::Find;
use Cwd;
 
my $ftprush_location = "C:\\Program Files\\FTPRush\\Queue"; # FTPRush queue location
 
sub return_file_list
{
  my @filelist;
  find(
    sub {
      if ( $File::Find::name =~ /rfq$/i )
      {
        push @filelist, $File::Find::name;
      }
    },
    $ftprush_location
  );
 
  return @filelist;
}
 
foreach(return_file_list()){
  open(FILE, $_) or die "Couldn't open $_";
  my $file = ;
  close FILE;
 
  if($file =~ /\bLocal\b/){
    print "File $_ contains localhost downloads\n";
  }
  else{
    print "Deleting $_\n";
    unlink or print "$!\n";
  }
}

● ● ●

Artem Russakovskii is a San Francisco programmer, blogger, and future millionaire (that last part is in the works). Follow Artem on Twitter (@ArtemR) or subscribe to the RSS feed.

In the meantime, if you found this article useful, feel free to buy me a cup of coffee below.



Share
  • Anton

    Thanks. Download and use it.