replace in filenames script not working

… or at least not completely.

I use it to clear filenames of characters that Windows can’t read, as part of syncing with Dropbox. (,/,:, and so on).

I select all the titles I wish to do a find/replace on, but the script leaves many instances of the invalid characters, which I have to go through and fix manually. Has anyone else had this issue?

Are you sure that you’re looking in the File column rather than the Title column? If that’s not it, please give a specific example of what the File column shows, what you told the script to replace, and what the File column shows afterwards so that I can take a closer look.

I finally got back to testing this.

What I’m doing is to select all (Command-A) while I’m in the Records file, with the cursor clicked on any one file. All files get selected. I then go up to the scripts pull-down menu and run the “replace in filenames” script. For example, I search for / , ; , : , ", etc. (one at a time) and replace with a period.

I’m finding that it works for ; and : but not " or /.

Here are some file names that remain unfixed:

The Art Institute of Chicago/ Calendar/ Events.pdf

PLoS ONE/ Can Playing the Computer Game “Tetris” Reduce the Build-Up of Flashbacks for Trauma? A Proposal from Cognitive Science

Press Kit/ The Art of Ancient Greek Theater.pdf

SAMSUNG Samsung SyncMaster P2570 24.6-inch Widescreen Color LCD Monitor / Parts & Upgrades . Dell

It may be catching some slashes but not all; I can’t tell.

duplicate post deleted

The script operates on Unix filenames, so to replace a / you would need to search for :. There seems to be a bug with this, as I get an error in Console:

11/23/10 2:44:46 PM EagleFiler[46554] An exception was thrown during execution of an NSScriptCommand…
11/23/10 2:44:46 PM EagleFiler[46554] The index -1 is invalid

so I will look into fixing that.

Replacing the quotes worked fine for me. Note that your example filename contains smart quotes, so you would need to search for and rather than ".

Error aside, what is the figure that represents a slash? I can’t “read” the symbol. (Colon-period? Period-colon?)

Colon.

This issue was related to long filenames containing periods. I’ve fixed it in EagleFiler 1.5.1.

thanks!
This is great–makes working between Windows and Mac much easier.

I used replace-in-filenames on pdfd bundles and see now that it did not replace the characters on the files contained in those bundles.

Should I export and delete the bundles and fix externally – or ??

EagleFiler only cares about the top-level filename of the package. It has no business modifying the contents. I think you can rename the package in EagleFiler, then open it in Skim and tell it to save the PDFD with the same name that it already has. Then Skim will regenerate the internal structure.

Thx – works like a charm :slight_smile:

Should this be included as a step in pdf-to-pdfd?

Not sure what you mean. The PDF to PDF Bundle script does use Skim to create a new package. So if the name was good before running the script, it should be good afterwards.

You’re right of course. (I’ll make a note to think in forward time.)

Would it be appropriate to include a note regarding this script sequencing on the pdf-to-pdfd page?

Also on that topic, iiuc, that script could be quickened by using Skimnotes convert in the convertFileToPDFD routine. (It avoids opening the file.)

Done.

Good to know, although I hesitate because I wonder if we can be sure that tool is installed at a known location.

Maybe call it at the default /Applications/Skim.app/Contents/SharedSupport/skimnotes and put a usage note in the instructions. (These days, are any users moving apps?)

I can get the location of Skim via AppleScript, but lots of apps move their helper tools around in the app package between releases.