News:

Needing some php assistance with the script on the main AARoads site. Please contact Alex if you would like to help or provide advice!

Main Menu

Why won't they let you use : or / in file names

Started by roadman65, May 31, 2014, 09:48:37 AM

Previous topic - Next topic

jeffandnicole

When I name a file which includes the date, I'll keep it short and simple: today is 060114. Yesterday was 053114. Next week is 060814. Easy to see the month, day & year. A typical file name would be "Report 060114". 

We could always go back to the era of 8 character file names, and file names without spaces.


Pete from Boston


Quote from: jeffandnicole on June 01, 2014, 09:25:36 AM
When I name a file which includes the date, I'll keep it short and simple: today is 060114. Yesterday was 053114. Next week is 060814. Easy to see the month, day & year. A typical file name would be "Report 060114". 

We could always go back to the era of 8 character file names, and file names without spaces.

I still tend to avoid spaces.  There are still instances where they can be problematic, so rather than keep track of which I default to no spaces.

Then again, I go back to the days of "B:? A second drive?"

sammi

Spaces are generally avoided on *nix systems, as far as I know. If you're on the command line, you usually have to type a backslash before the space, e.g.

xpdf /home/sammi/Downloads/PUB\ non-EDSA\ routes.pdf &

or just quote it like:

xpdf "/home/sammi/Downloads/PUB non-EDSA routes.pdf" &

By default it does the former.

It works similarly on Windows systems, except only the second is allowed. It was a pain in the ass (and it still is sometimes) to type

"C:\Documents and Settings\Administrator\ ..."

I generally avoid spaces myself for this same reason.

Quote from: jeffandnicole on June 01, 2014, 09:25:36 AM
When I name a file which includes the date, [...] Easy to see the month, day & year.

We were just having a discussion on ISO 8601. :bigass:

J N Winkler

Quote from: sammi on June 01, 2014, 10:23:22 AMIt works similarly on Windows systems, except only the second is allowed. It was a pain in the ass (and it still is sometimes) to type

"C:\Documents and Settings\Administrator\ ..."

I generally avoid spaces myself for this same reason.

Actually, this is not strictly true.  The space can be escaped in Windows in much the same way it is in *nix, only the escape character is a caret rather than a backslash, e.g.:

pushd Stargate^ SG-1\Season^ 02

However, I have a personal policy of avoiding spaces in filenames I generate myself, partly because they cause all sorts of problems with findstr and for /f loops.  Compare two text files, with identical content, one called temp.txt and the other called I have a space.txt:

FOR /F "tokens=1 delims=" %%A IN (temp.txt) DO . . .

is semantically identical to

FOR /F "usebackq tokens=1 delims=" %%A IN ("I have a space.txt") DO . . .

In the second case, the usebackq directive is necessary because otherwise the NT command interpreter parses the literal string I have a space.txt rather than the file with the same name.

In regard to findstr, some of the standard Windows tricks for dealing with spaces just don't work.  Consider a file, test.txt, containing only the phrase Therem Harth rem ir Estraven and a CR/LF pair.  This command

findstr Therem^ Harth test.txt

might be expected to print the file's single line at the command prompt in its entirety just once, but instead we get this:

FINDSTR: Cannot open Harth
test.txt:Therem Harth rem ir Estraven


Obviously, in this case findstr is interpreting Harth as the name of a file to be searched, rather than as part of the single search phrase Therem Harth.  But putting double quotes around the search phrase does not fix the problem.  The command

findstr "boo^ Harth" test.txt

might be expected to produce nothing since the file does not contain the phrase boo Harth, but instead it produces

Therem Harth rem ir Estraven

which indicates that the string within the double quotes is interpreted as two separate search phrases and findstr returns an "or" rather than "and" match.

There is really no way around these problems short of using the /c switch, so when single words and phrases with spaces have to be mixed in findstr input, it is quite fortunate that findstr allows multiple instances of /c.
"It is necessary to spend a hundred lire now to save a thousand lire later."--Piero Puricelli, explaining the need for a first-class road system to Benito Mussolini

sammi

Quote from: J N Winkler on June 01, 2014, 12:19:42 PM
Actually, this is not strictly true.  The space can be escaped in Windows in much the same way it is in *nix, only the escape character is a caret rather than a backslash [...]

I did not know that. All the more reason for me to use the Cygwin shell instead of CMD. :)

Scott5114

Ah, interesting. A: and B: were set up as I described above in my computer back when 5¼" floppies were still around. What happened if you had 3 floppy drives (not sure why you would, but...)?

I kind of miss floppy disks. If only they had a capacity similar to modern flash drives...
uncontrollable freak sardine salad chef

sammi

#31
Quote from: Scott5114 on June 01, 2014, 01:58:51 PM
I kind of miss floppy disks. If only they had a capacity similar to modern flash drives...

I've actually used floppy disks myself. The first one I used was 6 years ago; on it was an Excel file for a statistics project, which got corrupted because the computers at school had viruses on them. :ded: I used a second one right after that. :spin: And I used a few more (not for the same thing) before I got my first USB flash drive.]

I've used the 3½" ones, I've held 5¼" ones, and I haven't even seen 8" ones IRL.

J N Winkler

I am old enough to have booted computers straight from 5¼" floppies (our family got its first computer in 1984, when internal fixed disks were not common on consumer-grade computers).  I got rid of the last computer I owned that could read 3½" floppies in 2009, having copied the contents of all the floppies I had that could still be read (something like 2% to 5% were no longer readable) to a hard disk.

Frankly, I now regard removable media of any kind--floppy disks, USB keys, CDs, DVDs, Blu-Ray discs, etc.--as a necessary evil, because of the data segmentation and media rot problems, neither of which goes away whether you are working with 1.44 MB or 23.2 GB per storage unit.
"It is necessary to spend a hundred lire now to save a thousand lire later."--Piero Puricelli, explaining the need for a first-class road system to Benito Mussolini

1995hoo

My mom was a teacher and she persisted in using her floppy disks up until she retired in 2009 or 2010. She claimed it was because she had all her lessons organized in various directories on them and so she didn't want to change what she did; for some reason, she refused to entertain the idea of simply copying them all to the hard drive (their first computer back in the 1980s had no hard drive, but that wasn't unusual then) and then treating the floppies as a backup. My mom is not what I would call a Luddite by any means. I guess she just didn't see any reason to change what worked. She DID finally agree that floppies were outdated when I pointed out that one photo taken with my DSLR would take up three or four of her floppies if saved as a JPEG.

I found a bunch of my old floppy disks in my parents' basement last time I was over there. I took them with me and stuck them in our storage unit. I'd have to boot one of my old PCs (also in our storage unit) to figure out what was on the 3.5-inchers. Not sure I have a way to read the 5.25-inchers.
"You know, you never have a guaranteed spot until you have a spot guaranteed."
—Olaf Kolzig, as quoted in the Washington Times on March 28, 2003,
commenting on the Capitals clinching a playoff spot.

"That sounded stupid, didn't it?"
—Kolzig, to the same reporter a few seconds later.

J N Winkler

Quote from: 1995hoo on June 01, 2014, 03:10:33 PMI found a bunch of my old floppy disks in my parents' basement last time I was over there. I took them with me and stuck them in our storage unit. I'd have to boot one of my old PCs (also in our storage unit) to figure out what was on the 3.5-inchers. Not sure I have a way to read the 5.25-inchers.

There are USB drives you can buy to handle floppy disks in both sizes.  There is a more serious problem that has to do with obsolete operating systems.  In my family we started with the Apple II, which used a ProDOS operating system with its own disk format, and did not switch to Windows and the FAT/NTFS series of disk formats until 1993.  As a result, we have a fair number of old ProDOS floppies (in both sizes) with no clear idea of how to read them, although there is apparently now a free Apple Disk Transfer ProDOS program that can be used for this purpose.  Another consideration is that the option to print to PDF did not become available until the late nineties, so the data on those disks (mostly old AppleWorks files for my schoolwork in junior high and high school, but also some general-purpose utility files I had intended to keep up to date on an ongoing basis, such as a catalogue of my library, a list of books I had read, etc.) may not be accessible even with conversion filters.  As matters now stand, anything I did in high school or as an undergraduate is now effectively lost unless I printed out a clean copy for permanent storage.  I have a ten-ream box full of such copies which I think are going to have to be scanned to PDF sooner or later since, although I have the original files and access to software that can import them natively and print them to PDF, I really don't have the time to do all the setting and checking it would take to produce a clean PDF print for every single document.

What I remember most clearly from my campaign to copy over my floppies (from 2002 or thereabouts) is the sheer amount of time it took.  I had my disks divided between software and data, and just the data side of things involved feeding 124 disks into a floppy drive, one after the other, over the course of a couple of afternoons.  Software was another 52 disks.  That is 176 disks for 178 MB, which at the time took up barely one-third of the space on a CD--very painful.

After I had been collecting construction plans for several years (I started in 2002 on a Windows 98 PC that had a 30-GB hard drive) and using CDs for permanent archiving, I decided that I should also keep the plans on an external USB hard drive.  So in 2004 I purchased a 200-GB hard disk for this purpose.  This was equivalent to 307 CDs, and feeding CDs into the CD drive one after another was painful.  It was even more painful later when I accidentally started a format of the disk (thus rendering it unreadable and the data unrecoverable at reasonable cost) and had to copy hundreds of CDs' worth of data again.  Things aren't really much better now--my current disk (3 TB) is equal to 129 of my current archiving medium (Blu-Ray disc).
"It is necessary to spend a hundred lire now to save a thousand lire later."--Piero Puricelli, explaining the need for a first-class road system to Benito Mussolini

vdeane

Quote from: sammi on June 01, 2014, 12:01:12 AM
cat /dev/urandom | padsp tee /dev/audio > /dev/null
It gets really fun if you use files that have actual data in them...

Quote from: Scott5114 on June 01, 2014, 01:58:51 PM
What happened if you had 3 floppy drives (not sure why you would, but...)?
Were there ever motherboards that supported such a thing?

Quote
I kind of miss floppy disks. If only they had a capacity similar to modern flash drives...
Make a SD card that looks like a floppy and is the same (physical) size?
Please note: All comments here represent my own personal opinion and do not reflect the official position of NYSDOT or its affiliates.

CNGL-Leudimin

What is even stranger is they don't allow the question mark (?) because it is used for variables, but they do accept the inverted question mark (¿, used only in Spanish AFAIK) :ded:
Supporter of the construction of several running gags, including I-366 with a speed limit of 85 mph (137 km/h) and the Hypotenuse.

Please note that I may mention "invalid" FM channels, i.e. ending in an even number or down to 87.5. These are valid in Europe.

Scott5114

That's because, to the computer, they are as distinct as, say, "#" and "Q".
uncontrollable freak sardine salad chef

kkt

Quote from: J N Winkler on June 01, 2014, 02:43:24 PM
I am old enough to have booted computers straight from 5¼" floppies

I've booted from paper tape and front panel switches.

Pete from Boston


Quote from: kkt on June 02, 2014, 06:32:49 PM
Quote from: J N Winkler on June 01, 2014, 02:43:24 PM
I am old enough to have booted computers straight from 5¼" floppies

I've booted from paper tape and front panel switches.

I worked in an office that had no good alternative to 8" floppies for some of its equipment... in 1999, 28 years into the format's life.

doorknob60

Quote from: jeffandnicole on June 01, 2014, 09:25:36 AM
When I name a file which includes the date, I'll keep it short and simple: today is 060114. Yesterday was 053114. Next week is 060814. Easy to see the month, day & year. A typical file name would be "Report 060114". 

We could always go back to the era of 8 character file names, and file names without spaces.

You're doing it wrong. Now if you try to sort them, it will be a mess. Today is 20140605. Do it like that and it makes sense logically, and if you sort alphabetically, it will sort by date.



Opinions expressed here on belong solely to the poster and do not represent or reflect the opinions or beliefs of AARoads, its creators and/or associates.