Using Open with a filename that contains :Importing Quicken Tab Delimited .*TXT File and plottingCreate new file, based on 500 articlesWrite numbers to a fileimport file from directory using sftpImport a column of data, make a matrix from it and export it WITHOUT curly bracesExport to PDF so that Adobe Illustrator does not convert PlotMarkers to fontsExport many lists without using loopsExport[“test.txt”,111] doesn't export anything, generated a blank fileConvert CSV data for use with CandleStickChartChange input filename according to ticker
The rigidity of the countable product of free groups
What is a "Lear Processor" and how did it work?
Why does the Antonov AN-225 not have any winglets?
Could you brine steak?
Party going through airport security at separate times?
Elf (adjective) vs. Elvish vs. Elven
Using Open with a filename that contains :
Why archangel Michael didn't save Jesus when he was crucified?
Integer Lists of Noah
Why is the ladder of the LM always in the dark side of the LM?
What is the minimum time required for final wash in film development?
When I press the space bar it deletes the letters in front of it
[Future]Historical experience as a guide to warship design?
WTB Horizon 47c - small crack in the middle of the tire
Found and corrected a mistake on someone's else paper -- praxis?
What minifigure is this?
How to know if blackberries are safe to eat
Reverse dots and boxes
Help figuring a formula for my job
The joke office
Is it possible to split a vertex?
Can Jimmy hang on his rope?
Misspelling my name on my mathematical publications
What happens when adult Billy Batson says "Shazam"?
Using Open with a filename that contains :
Importing Quicken Tab Delimited .*TXT File and plottingCreate new file, based on 500 articlesWrite numbers to a fileimport file from directory using sftpImport a column of data, make a matrix from it and export it WITHOUT curly bracesExport to PDF so that Adobe Illustrator does not convert PlotMarkers to fontsExport many lists without using loopsExport[“test.txt”,111] doesn't export anything, generated a blank fileConvert CSV data for use with CandleStickChartChange input filename according to ticker
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
I am writing some data to a .txt file. I am using Open[] to create the text file in the directory I want and then Write[] and WriteString[]. (I am using FileNameJoin[] to create the actual filenames). I tried this out using a test file, called test.txt (and stored in the appropriate directory), it opens, writes to, and closes the file how I want. However, every time the notebook is run, I want to create a new output .txt file, so the files are named based on the date and time (in 24 hours), so part of the filename looks like HH:MM:SS. So, I am running something that looks like:
filename =
FileNameJoin["C:", "Users", "Me", "Dir1", "Dir2",
"2019-07-0810:59:01.txt"];
f=OpenWrite[filename]
Mathematica gives this error:
OpenWrite::noopen: Cannot open C:UsersMeDir1Dir22019-07-0810:59:01.txt.
I think what it doesn't like is the colons, since if I replace : with ; it opens/creates the file just fine (and it can open a file with just the date as the name). However, this is kind of ugly, and I would really prefer to use : instead.
Any suggestions are appreciated! Thanks you guys!
export import text output
New contributor
$endgroup$
add a comment |
$begingroup$
I am writing some data to a .txt file. I am using Open[] to create the text file in the directory I want and then Write[] and WriteString[]. (I am using FileNameJoin[] to create the actual filenames). I tried this out using a test file, called test.txt (and stored in the appropriate directory), it opens, writes to, and closes the file how I want. However, every time the notebook is run, I want to create a new output .txt file, so the files are named based on the date and time (in 24 hours), so part of the filename looks like HH:MM:SS. So, I am running something that looks like:
filename =
FileNameJoin["C:", "Users", "Me", "Dir1", "Dir2",
"2019-07-0810:59:01.txt"];
f=OpenWrite[filename]
Mathematica gives this error:
OpenWrite::noopen: Cannot open C:UsersMeDir1Dir22019-07-0810:59:01.txt.
I think what it doesn't like is the colons, since if I replace : with ; it opens/creates the file just fine (and it can open a file with just the date as the name). However, this is kind of ugly, and I would really prefer to use : instead.
Any suggestions are appreciated! Thanks you guys!
export import text output
New contributor
$endgroup$
2
$begingroup$
Personally, I solve this problem be replacing XX : YY : ZZ by XXhYYmZZs in the name of the file. Here is the code :StringReplace[DateString[], h : (_ ~~ _) ~~ ":" ~~ m : (_ ~~ _) ~~ ":" ~~ s : (_ ~~ _) :> h ~~ "h" ~~ m ~~ "m" ~~ s ~~ "s"]
. It solves a second problem too : sometimes (depending on the operating system) the seconds have decimals (10.45 for instance)
$endgroup$
– andre314
8 hours ago
$begingroup$
If you really want to put colons in file names, I suggest you use Linux. However, even there, I think they are better avoided.
$endgroup$
– mikado
7 hours ago
$begingroup$
Using the StringReplace info from @andre314, you might also consider using DateString["ISODateTime"] such as this: StringReplace[DateString["ISODateTime"], h : (_ ~~ ) ~~ ":" ~~ m : ( ~~ ) ~~ ":" ~~ s : ( ~~ _) :> h ~~ "h" ~~ m ~~ "m" ~~ s ~~ "s"] The result is a more compact representation.
$endgroup$
– Mark R
2 hours ago
add a comment |
$begingroup$
I am writing some data to a .txt file. I am using Open[] to create the text file in the directory I want and then Write[] and WriteString[]. (I am using FileNameJoin[] to create the actual filenames). I tried this out using a test file, called test.txt (and stored in the appropriate directory), it opens, writes to, and closes the file how I want. However, every time the notebook is run, I want to create a new output .txt file, so the files are named based on the date and time (in 24 hours), so part of the filename looks like HH:MM:SS. So, I am running something that looks like:
filename =
FileNameJoin["C:", "Users", "Me", "Dir1", "Dir2",
"2019-07-0810:59:01.txt"];
f=OpenWrite[filename]
Mathematica gives this error:
OpenWrite::noopen: Cannot open C:UsersMeDir1Dir22019-07-0810:59:01.txt.
I think what it doesn't like is the colons, since if I replace : with ; it opens/creates the file just fine (and it can open a file with just the date as the name). However, this is kind of ugly, and I would really prefer to use : instead.
Any suggestions are appreciated! Thanks you guys!
export import text output
New contributor
$endgroup$
I am writing some data to a .txt file. I am using Open[] to create the text file in the directory I want and then Write[] and WriteString[]. (I am using FileNameJoin[] to create the actual filenames). I tried this out using a test file, called test.txt (and stored in the appropriate directory), it opens, writes to, and closes the file how I want. However, every time the notebook is run, I want to create a new output .txt file, so the files are named based on the date and time (in 24 hours), so part of the filename looks like HH:MM:SS. So, I am running something that looks like:
filename =
FileNameJoin["C:", "Users", "Me", "Dir1", "Dir2",
"2019-07-0810:59:01.txt"];
f=OpenWrite[filename]
Mathematica gives this error:
OpenWrite::noopen: Cannot open C:UsersMeDir1Dir22019-07-0810:59:01.txt.
I think what it doesn't like is the colons, since if I replace : with ; it opens/creates the file just fine (and it can open a file with just the date as the name). However, this is kind of ugly, and I would really prefer to use : instead.
Any suggestions are appreciated! Thanks you guys!
export import text output
export import text output
New contributor
New contributor
New contributor
asked 8 hours ago
MissyinvisibleMissyinvisible
83 bronze badges
83 bronze badges
New contributor
New contributor
2
$begingroup$
Personally, I solve this problem be replacing XX : YY : ZZ by XXhYYmZZs in the name of the file. Here is the code :StringReplace[DateString[], h : (_ ~~ _) ~~ ":" ~~ m : (_ ~~ _) ~~ ":" ~~ s : (_ ~~ _) :> h ~~ "h" ~~ m ~~ "m" ~~ s ~~ "s"]
. It solves a second problem too : sometimes (depending on the operating system) the seconds have decimals (10.45 for instance)
$endgroup$
– andre314
8 hours ago
$begingroup$
If you really want to put colons in file names, I suggest you use Linux. However, even there, I think they are better avoided.
$endgroup$
– mikado
7 hours ago
$begingroup$
Using the StringReplace info from @andre314, you might also consider using DateString["ISODateTime"] such as this: StringReplace[DateString["ISODateTime"], h : (_ ~~ ) ~~ ":" ~~ m : ( ~~ ) ~~ ":" ~~ s : ( ~~ _) :> h ~~ "h" ~~ m ~~ "m" ~~ s ~~ "s"] The result is a more compact representation.
$endgroup$
– Mark R
2 hours ago
add a comment |
2
$begingroup$
Personally, I solve this problem be replacing XX : YY : ZZ by XXhYYmZZs in the name of the file. Here is the code :StringReplace[DateString[], h : (_ ~~ _) ~~ ":" ~~ m : (_ ~~ _) ~~ ":" ~~ s : (_ ~~ _) :> h ~~ "h" ~~ m ~~ "m" ~~ s ~~ "s"]
. It solves a second problem too : sometimes (depending on the operating system) the seconds have decimals (10.45 for instance)
$endgroup$
– andre314
8 hours ago
$begingroup$
If you really want to put colons in file names, I suggest you use Linux. However, even there, I think they are better avoided.
$endgroup$
– mikado
7 hours ago
$begingroup$
Using the StringReplace info from @andre314, you might also consider using DateString["ISODateTime"] such as this: StringReplace[DateString["ISODateTime"], h : (_ ~~ ) ~~ ":" ~~ m : ( ~~ ) ~~ ":" ~~ s : ( ~~ _) :> h ~~ "h" ~~ m ~~ "m" ~~ s ~~ "s"] The result is a more compact representation.
$endgroup$
– Mark R
2 hours ago
2
2
$begingroup$
Personally, I solve this problem be replacing XX : YY : ZZ by XXhYYmZZs in the name of the file. Here is the code :
StringReplace[DateString[], h : (_ ~~ _) ~~ ":" ~~ m : (_ ~~ _) ~~ ":" ~~ s : (_ ~~ _) :> h ~~ "h" ~~ m ~~ "m" ~~ s ~~ "s"]
. It solves a second problem too : sometimes (depending on the operating system) the seconds have decimals (10.45 for instance)$endgroup$
– andre314
8 hours ago
$begingroup$
Personally, I solve this problem be replacing XX : YY : ZZ by XXhYYmZZs in the name of the file. Here is the code :
StringReplace[DateString[], h : (_ ~~ _) ~~ ":" ~~ m : (_ ~~ _) ~~ ":" ~~ s : (_ ~~ _) :> h ~~ "h" ~~ m ~~ "m" ~~ s ~~ "s"]
. It solves a second problem too : sometimes (depending on the operating system) the seconds have decimals (10.45 for instance)$endgroup$
– andre314
8 hours ago
$begingroup$
If you really want to put colons in file names, I suggest you use Linux. However, even there, I think they are better avoided.
$endgroup$
– mikado
7 hours ago
$begingroup$
If you really want to put colons in file names, I suggest you use Linux. However, even there, I think they are better avoided.
$endgroup$
– mikado
7 hours ago
$begingroup$
Using the StringReplace info from @andre314, you might also consider using DateString["ISODateTime"] such as this: StringReplace[DateString["ISODateTime"], h : (_ ~~ ) ~~ ":" ~~ m : ( ~~ ) ~~ ":" ~~ s : ( ~~ _) :> h ~~ "h" ~~ m ~~ "m" ~~ s ~~ "s"] The result is a more compact representation.
$endgroup$
– Mark R
2 hours ago
$begingroup$
Using the StringReplace info from @andre314, you might also consider using DateString["ISODateTime"] such as this: StringReplace[DateString["ISODateTime"], h : (_ ~~ ) ~~ ":" ~~ m : ( ~~ ) ~~ ":" ~~ s : ( ~~ _) :> h ~~ "h" ~~ m ~~ "m" ~~ s ~~ "s"] The result is a more compact representation.
$endgroup$
– Mark R
2 hours ago
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
This is not possible. A colon is not a valid character in a file name on Windows.
Reference: https://docs.microsoft.com/en-us/windows/win32/msi/filename
$endgroup$
$begingroup$
You're right @Szabolcs, thanks! I am just so used to Linux.
$endgroup$
– Missyinvisible
6 hours ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "387"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Missyinvisible is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f201760%2fusing-open-with-a-filename-that-contains%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
This is not possible. A colon is not a valid character in a file name on Windows.
Reference: https://docs.microsoft.com/en-us/windows/win32/msi/filename
$endgroup$
$begingroup$
You're right @Szabolcs, thanks! I am just so used to Linux.
$endgroup$
– Missyinvisible
6 hours ago
add a comment |
$begingroup$
This is not possible. A colon is not a valid character in a file name on Windows.
Reference: https://docs.microsoft.com/en-us/windows/win32/msi/filename
$endgroup$
$begingroup$
You're right @Szabolcs, thanks! I am just so used to Linux.
$endgroup$
– Missyinvisible
6 hours ago
add a comment |
$begingroup$
This is not possible. A colon is not a valid character in a file name on Windows.
Reference: https://docs.microsoft.com/en-us/windows/win32/msi/filename
$endgroup$
This is not possible. A colon is not a valid character in a file name on Windows.
Reference: https://docs.microsoft.com/en-us/windows/win32/msi/filename
answered 8 hours ago
SzabolcsSzabolcs
169k17 gold badges461 silver badges983 bronze badges
169k17 gold badges461 silver badges983 bronze badges
$begingroup$
You're right @Szabolcs, thanks! I am just so used to Linux.
$endgroup$
– Missyinvisible
6 hours ago
add a comment |
$begingroup$
You're right @Szabolcs, thanks! I am just so used to Linux.
$endgroup$
– Missyinvisible
6 hours ago
$begingroup$
You're right @Szabolcs, thanks! I am just so used to Linux.
$endgroup$
– Missyinvisible
6 hours ago
$begingroup$
You're right @Szabolcs, thanks! I am just so used to Linux.
$endgroup$
– Missyinvisible
6 hours ago
add a comment |
Missyinvisible is a new contributor. Be nice, and check out our Code of Conduct.
Missyinvisible is a new contributor. Be nice, and check out our Code of Conduct.
Missyinvisible is a new contributor. Be nice, and check out our Code of Conduct.
Missyinvisible is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f201760%2fusing-open-with-a-filename-that-contains%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
$begingroup$
Personally, I solve this problem be replacing XX : YY : ZZ by XXhYYmZZs in the name of the file. Here is the code :
StringReplace[DateString[], h : (_ ~~ _) ~~ ":" ~~ m : (_ ~~ _) ~~ ":" ~~ s : (_ ~~ _) :> h ~~ "h" ~~ m ~~ "m" ~~ s ~~ "s"]
. It solves a second problem too : sometimes (depending on the operating system) the seconds have decimals (10.45 for instance)$endgroup$
– andre314
8 hours ago
$begingroup$
If you really want to put colons in file names, I suggest you use Linux. However, even there, I think they are better avoided.
$endgroup$
– mikado
7 hours ago
$begingroup$
Using the StringReplace info from @andre314, you might also consider using DateString["ISODateTime"] such as this: StringReplace[DateString["ISODateTime"], h : (_ ~~ ) ~~ ":" ~~ m : ( ~~ ) ~~ ":" ~~ s : ( ~~ _) :> h ~~ "h" ~~ m ~~ "m" ~~ s ~~ "s"] The result is a more compact representation.
$endgroup$
– Mark R
2 hours ago