Renamcon (REcursive NAMe CONverter) is a bash script implementing an Xdialog-based gui for the sed editor. The file renamers that come with Puppy are fine programs, but they do not operate recursively. To manipulate my music and photo files, I needed a program that would deal with thousands of files in hundreds of directories, some of them nested several layers deep. This script does so. It is not designed to replace PRename or gFnRename, but to complement them. It is only a single file, so I did not build a pet for it. Download the attached file, expand it, put it in a directory of your choice (/usr/sbin works well), give yourself permission to execute it, and start by double clicking its name. Alternately, drag it to the desk top, assign it an icon, and start it from there.

Renamcon automates a number of common filename conversions and replacements. It will rename either files or directories, and defaults to recurse through 50 layers of directories, but can be reset to recurse through any number. It processes requests sequentially. First, you select the starting directory and choose whether to accept the default recursion depth or change it -- not much need to change unless you want to limit your search to the current directory (depth = 1) or only a layer or two beneath it, or have directories stacked more than 50 deep. Then you decide whether to process directories, files, or particular files. If you select particular files, you enter the character pattern for the names you want to process (like "*.ogg" to find your music files). Then you jump to the main menu where you can select from a list of possible actions. You can execute multiple actions one after the other, or restart in order to select other files or directories. Read the mini-help file there for additional information.

The linux find command is used to locate the files to be processed. It is very fast. It lists all 59,000 files in my computer (2.53 GHz Celeron running Wary 5.0) in about 3-4 seconds . However, the items in the main menu examine each file matching your search criteria on a line-by-line basis. This is much slower. It takes about 40 seconds for my computer to list changes to 2500 files, and 35 seconds to implement those changes. So if you need to search for a particular pattern to replace, do it when you are asked for particular files, and not from the main menu.

After the potential changes have all been found, they are presented to you for confirmation in an Xdialog editbox. This widget lets you edit its contents, so you can make additional changes there if you want to. I don't recommend it. One of the nice features of doing everything sequentially is that if you make a mistake in any step, it is relatively easy to recover from it. Making arbitrary and random changes can only be corrected manually, if you can locate them again. And do not change the path names in the confirmation box because if you change a path name the program may not be able to find any files pointed to by the old path name.

I also recommend that if you are processing large numbers of files, or having trouble with renamcon, that you run it in a terminal. It will print its intermediate steps to the terminal so you can see what it is doing.

You can also use Renamcon as a simple file finder. Enter the starting directory, and choose particular files. Enter the appropriate search pattern, and from the main menu, select List only. It will locate and display all files matching your pattern.

In addition, Renamcon counts all the files matching your criteria giving you a quick reckoning of how many of what are in your computer.

This is its first release, so let me know if you encounter any problems. Feel free to modify the script for your own use, but if you pass it on, please comment any changes you have made.

Edit: In response to Flash's request, if you select 'Directories' and then 'List only' from the main menu, the directory listing will appear in treeview format with each subdirectory indented by 3 hyphens from the next higher level. Updated file attached.

Flash, renamcon will simply list the directories if you select directories instead of files. However, it is a simple list, not the diagramatic view that the Xdialog treeview widget yields. If that is what you need, pm me and I'll see if I can incorporate it.
BS

Wow, thanks! I only meant to find out how much trouble it would be to include the feature. I hope it wasn't very much trouble. Now I suppose I have to test it. That shouldn't take long at all.

No file management program I'm aware of in Linux or Windows offers the option of showing all the sub-directories in a directory in tree form, like Tree does. So, every time someone creates a new program that looks like it might naturally include that capability, I ask how hard it would be to include it. What I'm really asking is, is that capability a natural component of the program, but it was left out of the original specification of the program? Does that make sense?

Later: Okay, I tried it and found that it does what I want and is very easy to use. I have a large number of audio books I've converted to mp3 so I can put more of them on my mp3 player, to listen to while I work. The problem is, when I want to put more of them on the mp3 player, I have to open each author to see what the book is, before I decide if I want to listen to it. Being able to see all the authors and books in a single tree view makes it much faster to decide which ones to put on the mp3 player. Thanks again!

Flash, glad you like it. The only changes necessary were basically the IF statement lines, 313-317. If you want some other character than --- to precede the listings, open the script and substitute the character of your choosing in line 314 in place of the --- that is already there.

sc0ttman, input the string to replace, a slash as shown, and the string to use in place of the old one. If in doubt about anything, simply try it; renamcon always presents the proposed changes first, and will not commit to them unless you answer OK.

I am a bit in doubt about designing custom software for each user's needs. This script is very easy to modify, and pretty well documented internally. If you want fixed length/width dialog boxes, open the script in Geany, search for 0 0 (zero-space-zero), and replace the zeros with the length and width you like.

Hello. I would like to use this on my nano note. The NN OS is quite like Puppy. I have replaced xdialog with "dialog" because I have no X one my NN and no xdialog in ubuntu. Trying to run it on ubuntu but I get "Unexpected error with change_dir."

Your help/time/work/assistance will be appreciated._________________adobe flash is rubbish!
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum