Ncftp Free Scriptable FTP Client

NcFtp has got free scriptable multi platform ftp clients which are developed at least since the year 2000. If you have to use ftp with scripts, give it try.
ncftpput, ncftpget and ncftpls will make your life easier.

How to Delete Files via FTP in a Script?

Sadly, there is no ncftpdelete or the like. But to remove files scripted via ftp from a windows machine, you can use the scripting feature of windows’ own ftp client.

First, create a text file called del.ftp with content like this:

open server.99-developer-tools.com
user
password
delete dir/file123.foo
quit

Then run ftp -s:del.ftp. This will execute all the ftp commands in the file del.ftp.

Double Commander: Less Known Features

I love Double Commander (DC) as a two-pane file manager and have already written about its basic features, how to add 7z support and some svn woes.

But DC has got some advanced features which you maybe wouldn’t expect.

  • Under Files-Multi Rename it has got a tool with which you can do a rule-based rename of many files easily. Very useful e.g. to rename songs downloaded from wherever.
  • You can create symbolic and hard filesystem links. (Files-…)
  • Under Files-Compare by Content you’ll find a diff tool. But you could also configure DC to use the diff tool you prefer.
  • You can use DC as a FTP-client. When using this feature the first time, do this:
    1. Select Commands-Open VFS List.
    2. One of the panes then will show the entries FTP and Network.
    3. Double-click on FTP, then it will show Add connection and Quick connection.
    4. Double click one of them to add a connection.

DC is extremely configurable and extensible. Some examples.

  • The toolbar is fully configurable:
    1. Go to Configuration-Options-Toolbar.
    2. Click Insert new button.
    3. Select an internal command from the combobox or create an external command. You can use anything you want as a command and you can pass parameters like the currently selected file or path to it.
    4. Add a tooltip, icon and hotkey as you like.
  • You can connect file extensions with commands and hotkeys. For example, I as a software developer often need to know the version of a certain dll.
    So I connected the F3 key with a viewer for the dll version like this:

    1. Open Options dialog, select node File associations.
    2. Under File types select Add and add file type dll.
    3. Under Extensions select Add and type in dll.
    4. Under Actions select Add and then click the + and select View. This relates to the View command or cm_View in the DC.
    5. Under Commad select the + on the right and there Run in terminal (as my version reading program is a command line tool). Then select full path under the +. Resulting is a command like {!SHELL} version.exe %p

    Now, when a dll is highlighted and I hit F3, its complete version info is shown. Much easier and faster than right-click-properties-details.

  • You can color files according to their types: Configuration-Options-Colors-File types
  • All hotkeys are configurable: Configuration-Options-Keys-Hot keys

Find out which process is locking a file or folder in Windows

For Windows 7, 8 and 10 you can use the built-in Resource Monitor for this.

  1. Open Resource Monitor, which can be found by searching for resmon.exe in the start menu, or as a button on the Performance tab in your Task Manager.
  2. Use the search field in the Associated Handles section on the CPU tab
    pointed at by blue arrow in screen shot below.

In case it’s not obvious, when you’ve found the handle, you can identify the process by looking at the Image and/or PID column.

You can then close the application if you are able to do that, or just right-click the row and you’ll get the option of killing the process right there. Easy peasy!

>

Remark: The complete text and the picture above are taken from one of the answers to the question on superuser.com.
Some of the comments there claim that sometimes they could not find handles with Resmon but could find them with Process Explorer. Some others claim they could not find handles with Process Explorer but with Resmon.

I’d like to add, if you are looking for the directory C:\alpha\beta\gamma, you can enter in the search field
* gamma or GAMMA or \Gamma
* beta\gamma
* beta or \beta\
* C:\alpha\beta\gamma
* You cannot use slashes instead of backslashes.

Keywords: Block, Delete, Handle, Lock

Delete older files with Unix find and xargs

find . -type f -mtime +5  -print0 | xargs -0 rm
find . -type d -depth -print0  | xargs -0 rmdir  2>/dev/null

With these two bash commands, you can recursively delete all files older than 5 days and after that all now empty directories. I use these commands to clean up temp directories.

In the first line -mtime +5 finds all files that are older than 5 days. The + sign is important. Without it, only those being exactly 5 days (5 * 86400 seconds) old would be found.

In the second line -depth makes that child directories are treated before parents. That is important here. Otherwise a directory a which contained only an empty directory b would not be deleted.

rmdir only deletes empty directories. For that you don’t see rmdir's griping about non-empty ones, the 2>/dev/null is used.

Double Commander: Add 7-zip Support

I’ve sung a hymn on Double Commander in a previous post.

And after having used Double Commander some weeks, I got a bit annoyed by the fact that it didn’t handle 7z archives like zip archives. How to add 7-zip support to Double Commander 0.5.8 will be explained here.

Double Commander supports Total Commander plugins. There are several 7-zip plugins for Total Commander available from the net. Which is a problem, because only the last one you’ll try will work 😉

Do not use version 1.0.1.0 of 2005 of the 7-zip plugin by Alexander Cherenkov. This won’t work well, at least not with any of the four or so 7-zip versions I’ve tested. It will cause hangs and other malfunctions.

I’ve also come across a 7-zip plugin that has been marked as malware by VirusTotal. But you are careful in respect to what you download from the internet, isn’t it?

I now use version 0.7.6.5.a of 2011 by Adam Strzelecki and others. This has a fitting 7-zip version built into itself. It does not work perfectly, but quite well. I’ve removed some stuff that’s unneeded for Double Commander and repacked it to create wcx_7zip0.7.6.5b.bin.zip. You can download wcx_7zip0.7.6.5b.bin.zip here.

DC-Options

Installing it is no problem:

  1. Crete a directory $DC/plugins/wcx/7z, where $DC is the root installation folder of Double Commander.
  2. Extract 7zip.wcx or 7zip.wcx64 and 7zip.ini from the package wcx_7zip_0.7.6.5b.bin_.zip into the directory $DC/plugins/wcx/7z. You don’t need the other files in the package.
  3. In Double Commander, open the Options dialog and select  Plugins in the tree at the left and then the Packer Plugins tab.
  4. Press Add and select $DC/plugins/wcx/7z/7zip.wcx.
  5. Connect it with the file extension 7z.
  6. See image above for the result in the Packer Plugins tab.

How to Add Jar Extension to Zip Packer Plugin

Just because it fits here somehow and doesn’t deserve an own post:

  1. In Double Commander, open the Options dialog and select Plugins in the tree at the left and then the Packer Plugins tab.
  2. Select the line with the name zip.
  3. Press the Tweak button at the bottom of the page.
  4. In the upcoming dialog, press the Add new… button.
  5. In the following message box, type in jar and press Ok
  6. Close the dialog and press Apply on the Options dialog.