IBM Support

Renaming or Removing Files from the Integrated File System That Have Names That Are Not Valid

Technote (troubleshooting)


Problem(Abstract)

This document provides tips on how to delete documents and directories in the Integrated File System that were created with invalid names.

Resolving the problem

Certain applications may create invalid file names in the operating system Integrated File System. For example, a file name containing slashes or quotes is not valid and cannot be removed by the operating system file system code. When trying to rename or delete these files, the iSeries interprets the slashes and quotes as part of the file name and generates an error, CPFA0A9 Object not found, because this naming convention is not valid for the iSeries system.

Note: When this problem is encountered, the best way to remove or access these files is to use the same application that created them.

If the original application is not available or it is not able to remove these objects, there are some other options that can be used. These options include FTP, QShell, iSeries Navigator, IFS tools DLTIFSF, and CleanNames.

FTP

FTP can be used to rename or delete files and directories with invalid names that contain only standard ANSI characters. For example, FTP can be used to delete or rename files with names containing a backslash ('\'), but cannot handle names with embedded nulls or Unicode characters.

FTP Commands: REN (rename) and DEL (delete) for files, RMDIR (remove directory) for directories.

Note: Directories must be empty before they can be removed with the RMDIR command.

For example, a file was created in the root of the Integrated File System. The files is called \MYFILE.TXT and must be deleted. Below is a WRKLNK showing how this file looks in the operating system Integrated File System.

Work with Object Links

Directory . . . . : /

Type options, press Enter.
3=Copy 4=Remove 5=Next level 7=Rename 8=Display attributes
11=Change current directory ...

Opt Object link Type Attribute Text
QPWXGRB DIR
QPWXGUM DIR
QSR DIR
QSYS.LIB DIR PROD System Library
QTCPTMM DIR
QVGN DIR
RONTEST DIR
\MYFILE.TXT STMF
Snyder DIR
More...
Parameters or command
===>
F3=Exit F4=Prompt F5=Refresh F9=Retrieve F12=Cancel F17=Position to
F22=Display entire field F23=More options

Take the following steps to remove the file:

Note: An FTP session may be started either from the iSeries Command Line (on the same iSeries system or on a different iSeries system) or it may be started from a PC DOS Command Prompt.
1. To start an FTP session to the IBM System i system, on the operating system command line type the following command:

FTP <systemname>

Press the Enter key. You are prompted to sign on and type your password.
2. Once signed on, change the naming format from operating system to UNIX by issuing the NAMEFMT 1 command (quote site namefmt 1, and press the Enter key). The FTP session should respond with 250 Now using naming format "1".
3. To change to the root of the Integrated File System, type the following:

CD /

Press the Enter key. Response from the iSeries family system should be 250 "/" is current directory.

If the file is located in a directory or a subdirectory rather than on the root of the Integrated File System, issue CD dirname, and press the Enter key. Response from the iSeries family system should be 250 "/dirname" is current directory.
4. Type the following:

DEL \MYFILE.TXT

Press the Enter key. The response is 250 Deleted file /\MYFILE.TXT. This also works with the RENAME command.
Note: Remember that this is a UNIX format. Therefore, file names are case-sensitive.

The same steps may be used for removing directories with invalid names (such as \MYDIR). To do so, follow the steps above substituting the RMDIR command in place of the DEL command used in the example. If the directory which has the invalid character in the name contains other DIRs or STMFs, you will probably need to do a REN on the directory with the invalid character in the name and give it a valid name. At this point, you can use normal methods to delete the contents of the directory and remove it as you normally would.

QShell

QShell can be used to remove some invalid file names, including those that contain a backslash as part of the name. To remove a name with a backslash, escape the character with an additional backslash or double quote the name.

Example: To remove "myfi\le" use 'rm myfil\\le' or 'rm "myfi\le"'

To use QSHELL to remove the files, do the following:
1. From an operating system command line, type the following:

STRQSH  <enter>
2. To change directory to the directory containing the invalid file name, type the following:
CD mydir
3. To remove the file, type the following:
rm "invalid file name"
4. Press F3 to end QSHELL.
iSeries Navigator

The iSeries Navigator File Systems | Integrated File Systems option can be used to delete or rename files and directories with names that Windows considers invalid (and hence network drives can't handle). This includes names like *.* or *dir and many special ANSI characters such as the trademark symbol (TM) and so on.

To use iSeries Navigator to remove or rename the files, do the following:
1. Open iSeries Navigator.
2. Expand My Connections.
3. Expand File Systems.
4. Expand Integrated File systems and locate the directory or file containing the invalid file name.
5. Right click on the directory or file name and chose the option to delete or rename the file.


WRKLNK Option 4=Remove

The WRKLNK command is not Unicode-enabled. It cannot work with files or directories that have ANSI or Unicode characters that do not exist in the operating system CCSID.


EDTF

EDTF STMF(/)  <enter> will list Stream Files and Directories on the root of the IFS. Normal IFS commands (5 to display, and so on) can be used to locate the Stream File with the invalid name.

Use opt 4 to delete file or opt 9 to delete a directory and its contents.


QP0FPTOS API

New functions have been added to the "Perform Miscellaneous File System Functions (QP0FPTOS)" API that enable users to rename objects with unusable names. The new functions are documented in APARs SE40484 (5.4) & SE39917 (6.1) and cover letters for SI37426 (5.4) & SI37419 (6.1). The PTF must be applied before the tool can be used to rename file(s).

Following, are the special instructions from the PTF cover letters:

1) CALL QP0FPTOS PARM(*DUMPDIR '/path/to/directory')                        
CALL QP0FPTOS PARM(*DUMPDIR '/path/to/directory' *PRBONLY)      

The '/path/to/directory' must be specified in the current job CCSID. These invocations will dump the contents of the specified directory to a spooled file. The spooled file will contain each link name in the current job CCSID and a hexadecimal representation of the link name in CCSID 1200 (UTF-16). Certain entries may also indicate that a "problem" exists for the link name. A link name contains a "problem" if it contains any of the following:

- Characters that can not be converted to the current job CCSID
- Slash (/)
- Backslash (\)
- Asterisk (*)
- Question mark (?)
- Single-quote (')
- Double-quote (")
- Tilde (~)
- Colon (:)
- Space ( )

If the optional third parameter is omitted, all entries in the directory will be dumped to the spool file. Entries that contain problems can be found by searching for the string "PROBLEM:". If *PRBONLY is specified as the third parameter, only entries containing problem characters will be dumped to the spool file.

2) CALL QP0FPTOS PARM(*RENAME 'old-hex-name' 'new-name')

This invocation will rename a link in the current working directory. The 'old-hex-name' is the hexadecimal representation of the name in CCSID 1200 (UTF-16) that is obtained from the *DUMPDIR output. In the *DUMPDIR output, this representation is titled 'UNICODE' rather than 'HEX'.

The 'new-name' is a name specified in the current job CCSID. For example, if directory '/A/B' contained a link name with slashes, '/C/D', the following commands could be used to rename the link to 'NEWNAME':

CHGCURDIR DIR('/A/B')                                                      
CALL QP0FPTOS PARM(*RENAME '002F0043002F0044' 'NEWNAME')

3) CALL QP0FPTOS PARM(*RENAMEPRB '/path/to/directory')          

This invocation will rename all entries in the specified directory that contain the slash (/) character. All of the slash characters in the names will be changed to hyphens (-). For example, if directory '/A/B' contained several link names with slashes ('/C/D', '/E', '/F/G/H'), the following command could be used:

CALL QP0FPTOS PARM(*RENAMEPRB '/A/B')

When the command completed, the problem names would be '-C-D', '-E', and '-F-G-H'. These names can then be easily removed or further renamed through other normal interfaces. The command generates a spooled file where the success or failure of file system operations is reported.


Cross reference information
Segment Product Component Platform Version Edition
Operating System IBM i 6.1

Historical Number

15234725

Document information

More support for: IBM i
Integrated File System

Software version: Version Independent

Operating system(s): IBM i

Reference #: N1019639

Modified date: 14 December 2012


Translate this page: