![]() That's how we ended up with the backslash as a path separator. Like NutraSweet and Splenda, neither is really an acceptable substitute for a space, but we might as well follow the established convention instead of inventing our own. This_is_a_single_word, but this-is-multiple-words. Here's RegexBuddy matching the w operator against multiple ASCII character sets:Īs you can see, the dash is not matched, but underscore is. The slightly longer answer is, the underscore is traditionally considered a word character by the w regex operator. You'd have to search for kw1_kw2 as a query term to bring up that page. So bla.com/kw1_kw2.html wouldn't show up by itself for kw1 or kw2. ![]() If you use an underscore '_' character, then Google will combine the two words on either side into one word. The short answer is, that's what Google expects: Historically, I've used underscore, but I recently discovered that the correct character to substitute for space is the dash. So it behooves us to use something other than a space in file and folder names. XCOPY c:\test-files\reference-data.doc d:Īny spaces in URLs are converted to the encoded space character by the web browser: They're great for human readability, but they're remarkably inconvenient in computer resource locators:Ī filename with spaces has to be surrounded by quotes when referenced at the command line: XCOPY "c:\test files\reference data.doc" d: By using these methods, users can efficiently rename files with dashes at the beginning and avoid any potential issues with mistaken filenames as options.I try to avoid using spaces in filenames and URLs. These methods include using the current directory path, using the absolute file path, and using double dash. In this article, we discussed three methods to rename files starting with dash in Linux and provided the full code for each method. Renaming files starting with a dash in Linux can be a bit tricky, but there are several ways to do it. For illustration I have used the above syntax to rename a text file whose name is “-testfile.txt” to “myfile.txt”: Here “-file-name” is the original filename with a dash at the beginning and the “mv” command is used to rename the file to “new-file-name” using double dash. How ever, when Word saves the new document, the filename it creates stops at the first dash and excludes the remainder of the name. I always include the filename I want to use as the first line in a new document. The double dash tells the command that all arguments after it are not options, here is the syntax for this method: I frequently create filenames with dashes in them. The third method to rename files starting with a dash is to use double dash (–). is the original filename with a dash at the beginning and the “mv” command is used to rename the file. Here in the above syntax is the directory where the original file is located. This method involves specifying the full path to the file, which ensures that the filename is not mistaken for an option, here is the syntax for this method: If a file name has spaces, I will need to use the escape character code /code to access it. Here in the above syntax “-file-name” is the original filename with a dash at the beginning and the “mv” command is used to rename the file to “new-file-name.” For illustration I have used the above syntax to rename a text file whose name is “-testfile.txt” to “myfile.txt”:Īnother method to rename files starting with a dash is to use the absolute file path. It is better for several reasons (I will name a few): 1. To do this, you can use the “./” symbol before the filename to specify that it is a file and not an option, here is the syntax for this method: mv. One way to rename files starting with a dash is to use the current directory path. ![]() Method 1: Using the Current Directory Path There three ways to rename a file that starts with dash and here are those three commonly used methods: How to rename file starting with dash in Linux? This article will discuss three methods to rename files starting with dash in Linux and provide the full code for each method and the distro I will use is Linux Mint 21. However, there are several ways to rename files that start with a dash in Linux. Renaming files with a dash at the beginning can be a bit tricky because some commands may mistake the filename for an option. ![]() In Linux, file names that start with a dash (-) are treated as command-line options, which can cause issues when trying to rename them. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |