invalid characters / syncing with Dropbox

Eaglefiler seems to make use of names in the style of : libraryname/subfolder/filename, etc. … but when you sync with Dropbox, no Window computer can see a file whose name contains a “/”.

My efforts to strip these out using the file-rename script don’t seem to work. (I select library then run the script, searching for “/” and replacing with “.” or “|” (or somesuch). Is that the right procedure? A large swath of my files are not syncing …

If you mean this script, it operates on the selected files. Selecting the library itself will do nothing. Also, this script operates on filenames at the Unix level. So to search for “/” as shown in the Finder you would need to search for “:” (and vice-versa).

I’m not sure what you mean about “libraryname/subfolder/filename”. That looks like a path, not a filename. EagleFiler will generally only put “/” in a filename if you import a Web page containing that character in the title.

Yes, I was figuring out what you’ve pointed out. Drop box will give a list of “bad” file names, and it presents the whole file path, which confused me. I should concentrate on the name only.

thanks for the tip on / and : …

Would it make sense to elaborate this script into a RenameForDropbox script to conform with the https://www.dropbox.com/help/145 stricture to “avoid characters incompatible with the Windows file system.” Perhaps a default substitution of a space for < > : " / \ | ? *

A “make filenames compatible with Windows/Dropbox” would be wonderful …

Here’s a script to do that.

I don’t think that could have been done any faster. ;-> !

Iiuc, replacing with a space should suffice quite nicely for most cases. But as there might be special cases (such as backslashes needed in Applescripts for shortcuts), maybe include a caveat in the instructions?

That’s a godsend for my workflow.

I neglected to include the one other Dropbox requirement: trimming trailing spaces in the basename.

I was also thinking that perhaps the conversion should be more finely parsed to reflect how characters are typically (?) used in filenames – something like:

on processName(_name)
	set _invalidChars to "<>//\\|"
	repeat with _c in _invalidChars
		set _name to my replace(_name, _c, "-")
	end repeat
	set _invalidChars to "\"?*"
	repeat with _c in _invalidChars
		set _name to my replace(_name, _c, " ")
	end repeat
	set _invalidChars to ":"
	repeat with _c in _invalidChars
		set _name to my replace(_name, _c, " -")
	end repeat
	return _name
end processName

AFAIR, within basenames, a space is a good-enough substitute for most double quotes, question marks, and asterisks. But as backslash, forward slash, and vert bar are only used as separators, a hyphen is better than a space for readability (IMO). I preceded the colon with a space to match the space that generally follows within basenames.

Thoughts about including the above in your script?

Sounds good; thanks.

I’ve also modified the script to remove trailing spaces.

This script isn’t working for me. Do I have to do something more than download the compiled version and move it to the designated location?

Activity window shows no … activity … though the script for removing things one character at a time is working.

[removed by author (bad cold)]

Sorry about that. It was missing the “return _string” line.

Great. (Glad it wasn’t user error …)

Attached is a Unicode version of the script that replaces

  • ->, =>, etc., arrow-like strings with Unicode arrows.
  • Other illegal characters (including > and < not in arrows) with the corresponding Unicode fullwidth characters.

IMHO, this version generates filenames that are more readable than that given by ASCII substitutions.

The script also has some elaborated logic to handle “/” in Mac filenames.

The Unicode substitutions are:

<--> and <-> to ↔ (left-right arrow Unicode 034D)
--> and -> to ➝ rightwards arrow Unicode 2192)
<-- and <- to ← (leftwards arrow Unicode 2190)
<==> and <=> to ⇔ (left-right double arrow Unicode 21D4)
==> and => to ⇒ (rightwards double arrow Unicode 21D2)
<== and <= to ⇐ (leftwards double arrow Unicode 21D0)
> to > (fullwidth greater-than sign Unicode FF1E)
< to < (fullwidth less-than sign Unicode FF1C)
? to ? (fullwidth question mark Unicode FF1F)
* to * (fullwidth asterisk Unicode FF0A)
/ to / (fullwidth solidus Unicode FF0F)
\ to \ (fullwidth reverse solidus Unicode FF3C)
| to | (fullwidth vertical line Unicode FF5C)
: to : (fullwidth colon Unicode FF1A)
" to " (fullwidth quotation Unicode FF02)

Also attached is a Smart Folder that identifies filenames with illegal characters. To use: in Finder, unzip and copy into the Smart Folders folder in each EF library, click the “bad filenames” Smart Folder within a library, and select all files in the list window. Then run the attached AppleScript. (Note: the Smart Folder does not find files for which the only problem is that the basename ends with a space.)

Attachment?
Hi!

I know this thread is a bit old, but is it user error that I cannot find the attachments? Neither script nor smart folder show up on my screen…

Does anybody have an idea where I can find the two MIAs?

Thanks!

Hendrik

I’m not sure why the attachments aren’t showing up, but you can get them from the Internet Archive.

Attached
hth

EDITED: Here’s a dropbox link to same: https://www.dropbox.com/s/sfn1ypz5wk2mtwl/rename-for-dropbox-unicode.zip?dl=0

Thanks!
Wonderful! Thanks lot to both of you!

(…and I totally did not think about the way-back-machine. Great reminder!!)