path-separator

Why does the cmd.exe shell on Windows fail with paths using a forward-slash ('/'') path separator?

天涯浪子 提交于 2019-11-27 22:12:38
Just when I'd thought I'd seen it all with Windows path issues, I've now encountered a case that only fails when '/' (forward-slash) is used as the path separator is used: C:\temp\tcbugs>mkdir "dir1 with spaces" C:\temp\tcbugs>echo hi > "dir1 with spaces"\foo.txt C:\temp\tcbugs>type "dir1 with spaces\foo.txt" hi C:\temp\tcbugs>type "dir1 with spaces/foo.txt" The system cannot find the file specified. What is particularly interesting about this is that it appears to be specific to the cmd.exe shell and doesn't occur in PowerShell (nor presumably in the win32 API): PS C:\temp\tcbugs> type 'dir1

File.separator vs. File.pathSeparator [duplicate]

对着背影说爱祢 提交于 2019-11-27 21:44:33
问题 This question already has an answer here: File.separator or File.pathSeparator 3 answers File has the static Strings separator and pathSeparator. The separator is a "default name-separator character" and the pathSeparator is a "path-separator character". What is the difference? Is there a time when one is preferable to the other? 回答1: java.io.File class contains four static separator variables. For better understanding, Let's understand with the help of some code separator: Platform dependent

File path issues in R using Windows (“Hex digits in character string” error)

主宰稳场 提交于 2019-11-26 23:41:10
I run R on Windows, and have a csv file on the Desktop. I load it as follows, x<-read.csv("C:\Users\surfcat\Desktop\2006_dissimilarity.csv",header=TRUE) but the R gives the following error message Error: '\U' used without hex digits in character string starting "C:\U" So what's the correct way to load this file. I am using Vista replace all the \ with \\ . it's trying to escape the next character in this case the U so to insert a \ you need to insert an escaped \ which is \\ Please do not mark this response as correct as smitec has already answered correctly. I'm including a convenience

Get directory separator char on Windows? ('\', '/', etc.)

故事扮演 提交于 2019-11-26 21:46:10
问题 tl;dr: How do I ask Windows what the current directory separator character on the system is? Different versions of Windows seem to behave differently (e.g. \ and / both work on the English versions, ¥ is apparently on the Japanese version, ₩ is apparently on the Korean version, etc... Is there any way to avoid hard-coding this, and instead ask Windows at run time? Note: Ideally, the solution should not depend on a high-level DLL like ShlWAPI.dll , because lower-level libraries also depend on

File separators of Path name of ZipEntry?

陌路散爱 提交于 2019-11-26 21:10:00
问题 ZIP entries store the full path name of the entry because (I'm sure of the next part) the ZIP archive is not organized as directories. The metadata contains the info about how files are supposed to be stored (inside directories). If I create a ZIP file in Windows, when I unzip the data in another OS, e.g. Mac OS X, the file structure remains as it used to be in Windows. Is this because the unzipper is designed to handle this, or isit because the file separators inside the ZIP are standard? I

Why does the cmd.exe shell on Windows fail with paths using a forward-slash ('/'') path separator?

不想你离开。 提交于 2019-11-26 20:37:46
问题 Just when I'd thought I'd seen it all with Windows path issues, I've now encountered a case that only fails when '/' (forward-slash) is used as the path separator is used: C:\temp\tcbugs>mkdir "dir1 with spaces" C:\temp\tcbugs>echo hi > "dir1 with spaces"\foo.txt C:\temp\tcbugs>type "dir1 with spaces\foo.txt" hi C:\temp\tcbugs>type "dir1 with spaces/foo.txt" The system cannot find the file specified. What is particularly interesting about this is that it appears to be specific to the cmd.exe

File.separator or File.pathSeparator

最后都变了- 提交于 2019-11-26 11:02:54
In the File class there are two strings, separator and pathSeparator . What's the difference? When should I use one over the other? user489041 If you mean File.separator and File.pathSeparator then: File.pathSeparator is used to separate individual file paths in a list of file paths. Consider on windows, the PATH environment variable. You use a ; to separate the file paths so on Windows File.pathSeparator would be ; . File.separator is either / or \ that is used to split up the path to a specific file. For example on Windows it is \ or C:\Documents\Test Karthik Ramachandran You use separator

File path issues in R using Windows (“Hex digits in character string” error)

北战南征 提交于 2019-11-26 10:09:33
问题 I run R on Windows, and have a csv file on the Desktop. I load it as follows, x<-read.csv(\"C:\\Users\\surfcat\\Desktop\\2006_dissimilarity.csv\",header=TRUE) but the R gives the following error message Error: \'\\U\' used without hex digits in character string starting \"C:\\U\" So what\'s the correct way to load this file. I am using Vista 回答1: replace all the \ with \\ . it's trying to escape the next character in this case the U so to insert a \ you need to insert an escaped \ which is \\

File.separator or File.pathSeparator

拥有回忆 提交于 2019-11-26 02:04:44
问题 In the File class there are two strings, separator and pathSeparator. What\'s the difference? When should I use one over the other? 回答1: If you mean File.separator and File.pathSeparator then: File.pathSeparator is used to separate individual file paths in a list of file paths. Consider on windows, the PATH environment variable. You use a ; to separate the file paths so on Windows File.pathSeparator would be ; . File.separator is either / or \ that is used to split up the path to a specific