Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does the server delete a file with a special character [.\] in its file name

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

The editor will share with you how the server deletes files with special characters [.] in the file name. I hope you will get something after reading this article. Let's discuss it together.

If the "special character" is'/', skip to the end of the question; if the special character is

An'or control character or Chinese character, please read on.

The typical solution is:

Rm-I some*pattern*that*matches*only*the*file*you*want

In that case, rm will ask you to confirm that no before deleting files that meet the conditions you have given.

If your shell changes the eighth bit of each character to zero, file it in Chinese

The name of the file may not be deleted!

Vs.

Rm-ri.

Such a rm will delete all files in the current directory, while deleting a file

I will ask you if you want to delete this file. Unfortunately, not every version of rm

It works that way. Furthermore, even if it works, doing so will change the location of the current directory

If you find all the subdirectories, you may want to use "chmod Amurx" to avoid making the subdirectories impossible to search.

To avoid terrible consequences. Please go deep before you do "rm-r" or "rm" with universal characters.

Breathe and figure out what you're doing!

Vs.

Find. -type f...-ok rm'{}'\

"..." Is a bunch of statements used to identify the name of a file, such as when finding a file with a question

Why do you use inode after using

Find. -num 12345-ok rm'{}'\

Or

Find. -inum 12345-ok mv'{} 'new-file-name\

Delete or rename. The option "- ok" tells find to confirm before executing the instruction.

. If you are sure that there is nothing wrong with the instructions, or if you are afraid that there are strange words in the files you have to deal with.

Yuan printing will make the screen a mess, so using the option "- exec" won't ask you first.

Recognize it.

What should I do when the file name contains'/'?

This type of file is a very special case and can only occur because of kernel's bug.

Often when writing NFS, there is no irregular file name from the remote machine.

Characters are filtered out. The first thing we need to do is to try to "" nbsp.

The question would be so strange.

The UNIX directory is really just a paired combination of a simple file name and inode number.

For example, the directory contains the following information:

Filename inode

File1 12345

File2.c 12349

File3 12347

Theoretically, the characters  nbsp;'/' and'\ 0' cannot be used in file names.

Because they have the following special uses:

'/': used to separate directory names from file names.

'\ 0': the Terminator used as the file name.

Very, extremely, unfortunately, the NFS made by some manufacturers is responding to the requests of remote machines.

When asking, it will foolishly create a file name with a slash (/). For example, when someone is on Mac

Or other non-Unix machines to create a file with the name of the date to your through NFS

In Unix. So, your Unix directory might look like this:

Filename inode

91-02-07 12357

None of the 'find'' or 'rm'' we mentioned earlier can delete this file because these or

Other Unix programs will force'/'to be interpreted as the aforementioned delimited character.

In fact, any ordinary program will try to do unlink ("91-02-07"), and this pair

For kernel, it means "files in subdirectory 02 under unlink directory 91."

Case 07, however, we do not have such a file, we have a person named

The files of "91-02-07" are in the current directory. This is a very subtle but very important difference.

What should I do at this time? First of all, go back to the Mac that produced this messy file name and give it a try.

See if NFS daemon wants to change you to a file name that doesn't contain'/'. If you can't, you have to

Asked your system manager for help. Ask him to try one of the following methods:

1. Use "ls-I" to find the inode number,umount of the file and drop this.

File system then clears the inode with "clri", and then

Pray for the success of fsck. This practice will delete the messy file name.

archives.

two。 If you still want to save the data in this file, try the following:

-build one under the parent directory of the directory where the messy file name is located.

Move all the files that can be moved under the old directory to the new directory

In.

-get the inode number of the old directory with "ls-id"

-unmount drop this file system and use "clri" to get rid of that.

Inode of the directory

-the "fsck" file system.

-start the file system on the new mount

-rename the new directory to the old directory name

-retrieve the file from lost+found, change its name, and put it back to the original

The catalogue from.

The code is as follows:

The general document creation method that I have tested

Method created under cmd: md jb51..\

Method of deletion: rd jb51..\

After reading this article, I believe you have a certain understanding of "how the server deletes files with special characters [.] in the file name. If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 286

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report