Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Sydde

macrumors 68030
Original poster
Aug 17, 2009
2,571
7,068
IOKWARDI
I want to do some file transfers, and I would rather not bother the user with "replace?" alerts. One option will be to just use the trash, but I also want to offer the option of tacking on a character (or characters) to the end of the file name to mark the new file. What characters would be terminal-safe? One I am considering in "_" (old file would be "file.ext", new file would be "file_.ext", adding underscores until the name is unique). Are "@", "^", "~" or "`" good alternatives? (One character for file names, another for links/aliases.)
 
I recommend "file-N.ext", where N is a series of increasing numbers, "1", "2", etc.

Avoid special characters because the target filesystem might not like them. Or the OS that eventually reads the filesystem might not.

And all characters are Terminal-safe, when quoted (yes, even quotes, when quoted or escaped). The advantage of avoiding specials and spaces is you don't have to force the user to add quoting due to the uniquefying part.
 
If the situation is that there will be a maximum of one "old" file, (you won't need 1,2,3...) then I have the feeling that "~filename" is an old answer to the problem.

But I can't remember where I get that feeling from.... emacs?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.