Discussion Locked

Download: Reclaim gigabytes by deleting files

0 helpful
13 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

https://www.techrepublic.com.com/5138-10590-5676717.html
and
https://www.techrepublic.com.com/5138-10592-5701632.html

Listing files on a hard drive, sorted by size, is not as simple as it sounds. The referenced download automated the process using Rexx scripts. [b]Do you have a similar script for accomplishing this task? We'd like to see it. What scripting language do you use?[/b]

13 replies

by stat geek

Downloading a PDF should be optional, but the format of the article should be HTML. Nuff said.

by doulos8

The article could have been in html instead of pdf.
The script can be copied from the pdf, but there are no carriage returns.

So, how does the script run? Well, after I muck around reformatting it, and then saving it with a .rex extension, it may run automatically in the regina interpreter I downloaded. I'm just guessing, since the article doesn't seem to describe how to actually RUN the script.

And TR, the hoops that you make us go through to read about a download, do the download, rate the download, and then get back to comment on it -- sheesh, do you think we've got all day. Your downloads are very user-unfriendly!

by doulos8

Well, I didn't recover gigbytes of space, but the script does what it's supposed to - which is why I downloaded it. And spent the time making it work:

1. Unlike the example in Listing B, the DIR command returns time in a single field, like 07:42p. So,

parse value line with date time am_pm size name

needs to be

parse value line with date time size name

Otherwise, the "format" function gets a file name instead of a file size.

2. 'wordpad' is not a recognized command, unless you provide a path (or if it's in your PATH). I used

'"C:\Program Files\Windows NT\Accessories\wordpad"' out_file /* Let user view the big files */

3. Then it appeared that files were being list multiple times. The sort_in file needs to be deleted or cleared before you start writing to it. I added this after the 'dir' command:

'del ' sort_file out_file /* Clear any existing output file */

Overall, a nice introduction to Rexx. (Reminds me a bit of awk from my Unix days.) A helpful little script. But not a real slick download.

by rimadog9

Great, quick-and-dirty way to extend the power of the standard utilities. Rexx is rich in built-in functions, good for handling strings, and runs almost everywhere. I've been using it on the mainframe for years. Best of all, it's easy to learn.

by foster2

Great point about the need to erase the output files. Otherwise the script gives correct results on the first run but accumulates info in the output files on subsequent runs.

Wordpad must be in your command path or you must add it. Or, change the script to issue a fully-qualified command, as you've shown.

As the article says "... you'll get a slightly different file list from the DIR command depending on which switches you use and your version of Windows." The output listing shown is for the command 'dir c:\ /-c /s' from the Windows XP sp 1 command processors.

Thanks for your improvements and feedback.

by alangeek

Don't get me wrong, I like REXX a lot, supported OS/2 for over 13 years, but I didn't think REXX was common on Windoze. I thought you had to purchase it to have it available. Am I mistaken? If it's in there, I'll start making much more use of it.

by alangeek

Sorry, I hadn't downloaded the stupid PDF file. What's the reasoning behind everything being a PDF instead of just putting the darn thing in HTML? It's just a waste of time and a pain in the butt!

by foster2

There are several Rexx interpreters available for free download for Windows. All meet the international Rexx standards, plus have extra functions and features just for Windows.

Free Rexx Interpreters:
Regina - http://regina-rexx.sourceforge.net/
Reginald - www.borg.com/~jglatt/rexx/rexxuser.htm
Open Object Rexx - www.oorexx.org
r4 and roo! - http://www.kilowattsoftware.com/

There are also over 100 free tools and interfaces for Rexx, most of which run on Windows.

The Rexx book at www.amazon.com/rexx goes into the differences between the products in detail.

by foster2

In the second Download ("Reclaim Gigabytes-- Code a Recursive Script to Identify Unneeded Files") Listing A is incorrect. This is due to an accidental PDF conversion error at the publisher. As the author of the article I have asked them to replace this incorrect Listing A with what I submitted.

The errors are very minor - so you may wish to correct them yourself. Just ensure that "sort file" and "output file" appear as single variable names, as: "sort_file" and "output_file".

Since Listing A is not posted as mono-spaced, the comments and code do not align as I sent it in. But remember that Rexx is a free-format language. So although it's unattractive to the human eye, poor spacing does not prevent Rexx code from running correctly.

Thank you for your patience with this error. TechRepublic posts so many goodies a mistake was bound to happen sometime.

Would you be interested in seeing some more useful Rexx utilities for Windows?

This discussion is closed to new replies.