Finally done…

November 1, 2012 · Posted in Geekness · Comments Off 

So I finally finished college this past week. O M G, it feels so good to be done.  College grad @ age 36! Better late than never.


Using forfiles.exe to delete old files…

August 4, 2012 · Posted in Geekness · Comments Off 

So I setup a PC DVR unit to handle some security cameras for a client of mine.  As a result, the *.avi files would start to eat up a lot of space after a month or so of recording.  So I elected to use the forfiles.exe program to take care of the problem.  Note this is a windows platform and if you are using anything pre-W2k3 (like XP), you’ll need to download the program from MS (link is for x86!).

For simplicity, I just saved it in c:\windows.  Next you’ll need to figure out the proper syntax to use for your needs.  Mine was to delete any .AVI file that was older than 7 days, located in a particular pathway, such as c:\dvr-video.  Below is what I am using…

FORFILES -pc:\dvr-video-s -m*.avi -d-7 -c”CMD /c del /q @FILE”

I would suggest you test this prior to blasting away your files.  The line below will echo all the files that would normally be deleted if you ran the command above.

FORFILES -pc:\dvr-video -s -m*.avi -d-7 -c”CMD /c ECHO @FILE”

I would also suggest you take a look at the FORFILES syntax flags. Here is a link to the CMD syntax flags too, if you are new to the command.  Once you have it all worked out, save it in a notepad file with a .bat extension.  Location doesn’t matter, just somewhere you can find it for the next step.

The final step is to fire up your Task Scheduler and configure it to run this batch file however often you need it to run.  Since my batch file deletes files older than 7 days, I run it once a week on Saturday, at 4AM.

Overall, it is a pretty simple setup.

2 things to note…

1. If your files have spaces in them, this won’t work.  The only workaround I know offhand is to use underscore or hyphens in your files names.

2. If there are spaces in your pathway, you’ll need to put it in quotes, like FORFILES -p”c:\my pathway\has spaces\to my\files”

Using ncftpget for automated FTP backups…

April 5, 2012 · Posted in Geekness · Comments Off 

So I like to use Mikrotik routers for moving bits around my networks and the Internet. In an effort to ensure I always have an off-host backup available, I’ve setup a backup process using ncftpget. I won’t cover how to setup cron jobs, hopefully you already know how to set one up. That said, this is a pretty simple setup.

I have my backups process nightly, at midnight. Here is a sample command syntax for my 750G called Gatekeeper:

cd /home/mikrotik/Gatekeeper_RB750G && /usr/local/bin/ncftpget -f ../.netrc_gatekeeper ./ /*.backup

The first part of the command drops you into your storage directory. The second part tells ncftpget to use the server and login information contained within the file .netrc_gatekeeper and to download any files matching the *.backup wildcard. You can change this to suit your needs.

Here is an example of how your .netrc file should look like:

machine 'IP/hostname'
user your_ftp_username
pass your_ftp_password

Note: You’ll need to create a separate .netrc file for each host you want to backup. Hence, my naming scheme of .netrc_hostname.

Here is a second command syntax example for my 493AH called Keymaster:

cd /home/mikrotik/Keymaster_RB493AH && /usr/local/bin/ncftpget -f ../.netrc_keymaster ./ /*.backup

BackupPC is magic…

February 3, 2012 · Posted in Geekness · Comments Off 

Well, I’ve been using BackupPC for about half a year now. I’m pretty happy with it. For an open source application, it is pretty polished. At the several businesses where I’ve been asked to pitch a backup application for LAMP server farms, I’ve had great success with this software. I love open source. It is definitely a way to to knock out backups for your LAMP server with minimal cost. Providing a company or individual has the in-house talent to set it up (it ain’t rocket science!), your cost for a robust, enterprise capable backup application, is limited to your hardware costs.

Now, recently I ran into a problem with BackupPC, running on CentOS 5.7. After a yum update, when trying to process a backup job, BackupPC would error out with a Compress::Zlib error. After much google-fu, I came across this guy’s solution. Doing a force install on CPAN solved my problem. Hope this helps someone else.

  • Randoms


    Views: 594

  • Latest Geek MPG

  • Phoenix