Copy link to clipboard
Copied
Trying to save the JPG file with name containing '%' in it i.e. 'Image100%.jpg' through javascript, it throws error 'Could not save a copy as "Image100%.jpg" becuase the file could not be found.
But the script works when the file name does not have '%', 'Image.jpg' but it is needed to add %.
How to resolve this error in javascript?
Copy link to clipboard
Copied
Hi @dt0245 that is a unsupported naming character for operating systems. You can't have a % (among other things) in a naming structure especially when saving.
Copy link to clipboard
Copied
This is not a Photoshop question — it's naming convention restrictions by Windows OS.
From Wikipedia
Windows
File system utilities and naming conventions on various systems prohibit particular characters from appearing in filenames or make them problematic:
Character | Name | Reason for prohibition |
---|---|---|
/ |
slash | Used as a path name component separator in Unix-like, Windows, and Amiga systems. (For as long as the SwitChar setting is set to /, the DOS COMMAND.COM shell would consume it as a switch character, but DOS and Windows themselves always accept it as a separator on API level.) The big solidus ⧸ (Unicode code point U+29F8) is permitted in Windows filenames. |
\ |
backslash | Used as the default path name component separator in DOS, OS/2 and Windows (even if the SwitChar is set to '-'; allowed in Unix filenames, see Note 1). The big reverse solidus ⧹ (U+29F9) is permitted in Windows filenames. |
? |
question mark | Used as a wildcard in Unix, Windows and AmigaOS; marks a single character. Allowed in Unix filenames, see Note 1. The glottal stop ʔ (U+0294), the interrobang ‽ (U+203D), the inverted question mark ¿ (U+00BF) and the double question mark ⁇ (U+2047) are allowed in all filenames. |
% |
percent | Used as a wildcard in RT-11; marks a single character. Not special on Windows. |
* |
asterisk or star |
Used as a wildcard in Unix, DOS, RT-11, VMS and Windows. Marks any sequence of characters (Unix, Windows, DOS) or any sequence of characters in either the basename or extension (thus "*.*" in DOS means "all files". Allowed in Unix filenames, see Note 1. See Star (glyph) for many asterisk-like characters allowed in filenames. |
: |
colon | Used to determine the mount point / drive on Windows; used to determine the virtual device or physical device such as a drive on AmigaOS, RT-11 and VMS; used as a pathname separator in classic Mac OS. Doubled after a name on VMS, indicates the DECnet nodename (equivalent to a NetBIOS (Windows networking) hostname preceded by "\\".). Colon is also used in Windows to separate an alternative data stream from the main file. The letter colon ꞉ (U+A789) and the ratio symbol ∶ (U+2236) are permitted in Windows filenames. In the Segoe UI font, used in Windows Explorer, the glyphs for the colon and the letter colon are identical. |
| |
vertical bar or pipe |
Designates software pipelining in Unix, DOS and Windows; allowed in Unix filenames, see Note 1. The mathematical operator ∣ (U+2223) is permitted in Windows filenames. |
" |
straight double quote | A legacy restriction carried over from DOS. The single quotes ' (U+0027), ‘(U+2018), and ’ (U+2019) and the curved double quotes “ (U+201C) and ”(U+201D) are permitted anywhere in filenames. See Note 1. |
< |
less than | Used to redirect input, allowed in Unix filenames, see Note 1. The spacing modifier letter ˂ (U+2C2) is permitted in Windows filenames. |
> |
greater than | Used to redirect output, allowed in Unix filenames, see Note 1. The spacing modifier letter ˃ (U+2C3) is permitted in Windows filenames. |
. |
period or dot |
Folder names cannot end with a period in Windows, though the name can end with a period followed by a whitespace character such as a non-breaking space. Elsewhere, the period is allowed, but the last occurrence will be interpreted to be the extension separator in VMS, DOS, and Windows. In other OSes, usually considered as part of the filename, and more than one period (full stop) may be allowed. In Unix, a leading period means the file or folder is normally hidden. |
, |
comma | Allowed, but treated as separator by the command line interpreters COMMAND.COM and CMD.EXE on DOS and Windows. |
; |
semicolon | Allowed, but treated as separator by the command line interpreters COMMAND.COM and CMD.EXE on DOS and Windows. |
= |
equals sign | Allowed, but treated as separator by the command line interpreters COMMAND.COM and CMD.EXE on DOS and Windows. |
|
space | Allowed, but the space is also used as a parameter separator in command line applications. This can be solved by quoting the entire filename. |
Jane