b3ta.com qotw
You are not logged in. Login or Signup
Home » Question of the Week » Redundant technology » Post 953379 | Search
This is a question Redundant technology

Music on vinyl records, mobile phones the size of house bricks and pornography printed on paper. What hideously out of date stuff do you still use?

Thanks to boozehound for the suggestion

(, Thu 4 Nov 2010, 12:44)
Pages: Latest, 14, 13, 12, 11, 10, ... 1

« Go Back

Damn it feels good to be a DOS geek...
I was tasked with copying a folder and its contents to another location and renaming everything from 50MMGD to 100MMGD (we were using it as the starting point for a new project). My boss smirked and said, "That ought to keep you busy for a few hours."

"Oh really?" I opened a DOS shell and typed in "ren 50*.* 100*.*" and sat back for a moment as it scrolled, then said "Okay, what next?"

It took him a moment to get his jaw off the floor.
(, Thu 4 Nov 2010, 16:26, 21 replies)
quite often Windows says you can't rename a file because it is in use
The dosbox ignores this :-) quite important when youre trying to fuck up a virus that has renamed itself after a proper system file.
(, Thu 4 Nov 2010, 16:30, closed)
Even better
He asked me to get rid of all the .bak files that AutoCAD had made. I typed "del *.bak" and let it scroll. I then grinned and said "Good thing I didn't type in .dwg, huh?"

His face turned pale and he quietly told me never to let the IT guys know that I could do that.
(, Thu 4 Nov 2010, 16:35, closed)
Tough call...
Show off like that, or do it on the quiet and spend a few hours looking busy while surfing the web?
(, Thu 4 Nov 2010, 16:30, closed)
It was an inefficiently run place anyway
so I had already gotten bored with the web and wanted something to do. I did that so he would stop giving me mundane shit and let me do something requiring thought.

Didn't work, though...
(, Thu 4 Nov 2010, 16:36, closed)
Do what I do
Start writing a novel and keep it on a flash drive. (Backed up regularly, of course.) You're typing and/or looking thoughtful, so you look busy and people hesitate to interrupt.
(, Thu 4 Nov 2010, 17:26, closed)
This ^
That's why I am a developer.
(, Thu 4 Nov 2010, 18:52, closed)
Task is not a verb
(Sorry, I've spent all day on and off conference calls being "tasked" and "actioned" with things...I've even been "given actions to take away" - ugh)
(, Thu 4 Nov 2010, 16:31, closed)
Sounds like
you're in need of some 'proactive enablement'. My other half came home the other day from a legal seminar in which a fairly high powered and eminent speaker repeatedly used the phrase 'in situations of dangerousness'!
(, Thu 4 Nov 2010, 17:06, closed)

But.. that would have renamed all the files from 50MMGD to 100MGD (the last 0 in 100 would ovewrite the first M in MMGD. You need to add a buffer character to make up for the additional 0.

ren 10*.* to 100*.*
renames 50MMGD to 100MGD

So you need to stick an x on the front like this:

setlocal enabledelayedexpansion
rem this ranmes 50MMGD to x50MMGD making space for the extra character.
for %%a in (*) do rename %%a x%%a
ren x10*.* 100*.*

OMG .. I'm a huge nerd. And if it were me, I would have used len, and made sure to only rename if the first three characters were [0-9].

I'm scaring myself as I write this.
(, Thu 4 Nov 2010, 17:55, closed)

you may need to write him a batch file to fix that :)
(, Thu 4 Nov 2010, 18:25, closed)
I don't follow your logic.
The asterisk replaces any number of characters so DOS (and, I think, BASH) would preserve the matched part and replace the non-matched.
(, Thu 4 Nov 2010, 18:34, closed)

X:\dir
Volume in drive X is System
Volume Serial Number is 1682-2120

Directory of X:\

2010-11-04 14:35 PM DIR .
2010-11-04 14:35 PM DIR ..
2010-11-04 13:53 PM 7 10test.txt
1 File(s) 7 bytes
2 Dir(s) 56,501,731,328 bytes free

X:\ren 10* 100*

X:\dir
Volume in drive X is System
Volume Serial Number is 1682-2120

Directory of X:\

2010-11-04 14:36 PM DIR .
2010-11-04 14:36 PM DIR ..
2010-11-04 13:53 PM 7 100est.txt
1 File(s) 7 bytes
2 Dir(s) 56,501,727,232 bytes free

X:\

I don't really understand how to word it, but it seems the * doesn't really hold the value, it just means anything including nothing. My experiments using ? instead of * yeilded the same results. I've always buffered them out. and I can't seem to put greater-than signs in this forum. Probably to stop stilly folks from playing with HTML.

I guess 'they' had to pick a awy to work that query. ren 10* 100* could also have meant append: like 10foo becomes 10010foo since * means any file. Or it could mean ren 10foo to 100[undefined], or rename 10foo to first hit on *. So reanme it could rename all files to 10foo (except rename won't allow that)... and so on. * is not like $1 in perl. it is $1 right ... ?
(, Thu 4 Nov 2010, 18:39, closed)

Am I breaking rules by chatting bout this? Please don't ban me, I'm just feeling chatty.

reaname 10* to 100* in a command shell means:
Take the first file that begins with with 10 and ends with anything, then make it begin with 100 and end it with what was already there. Overwriting as you go.

The shell isn't reaplacing 10 with 100, it is putting 100 at the beginning of the file, ovewriting what is already there. I can't remember bash so well, but I it works similar. Something like:
for f in 10*; mv $f 100`echo "$f" | cut 1-2`; done

Get a list of files 'f' that begins with 10, move $f to 100$f(with the first 2 characters (hopefully 10) cut off)

Don't copy and paste that into bash, I'm on a windows box now. I'm working with a very old manbrain.
(, Thu 4 Nov 2010, 19:01, closed)
On some csh shells you get rename:
rename 50 100 50*

Job done. DOS makes me feel a bit sick. It's like a proper shell's crippled cousin
(, Thu 4 Nov 2010, 20:26, closed)
Smiles...
All these replies have actually been interesting to read! As someone who still plays with command prompts and writes the odd script at work I love stuff like this!
(, Thu 4 Nov 2010, 23:48, closed)

/bin/csh

% ls
50test.txt
% rename 50 100 50*
% ls
50test.txt

didn't work.

I think (don't know) that 'rename' is a PERL script that's unlikely to be influenced much by the shell it's running on.

however rename does accept perl regexps... so you could use:
rename 's/^50/100/' 50*

Better than my messy sub routine.
(Just confirmed on my Gentoo system)
(, Fri 5 Nov 2010, 3:15, closed)
Sorry, you are right of course.
I forgot thar you can't rename like that because it only uses the * for pattern matching and the name of the file minus the matched but is not stored anywhere.
(, Fri 5 Nov 2010, 17:21, closed)
PROMPT
Do you use PROMPT to set your DOS prompt to wacky things? Because I do.
(, Fri 5 Nov 2010, 2:03, closed)

Yes. And I load ansi.sys so I can make it colour. I also use debug.exe like a hex editor and mod my command.com to call me stupid instead of "bad command or filename"
(, Fri 5 Nov 2010, 3:17, closed)
Amen
Unless you're running anything < ME you're really using Command Prompt.
(, Fri 5 Nov 2010, 16:07, closed)

As far as I know, unless you are using less than 98 you can't load ansi.sys. Can you? I use it in MS Dos 5.0 .. There is likely a TSR for all later versions of windows, that can be loaded into each session. An ansi.com or something.. bless real mode.
(, Fri 5 Nov 2010, 18:11, closed)

« Go Back

Pages: Latest, 14, 13, 12, 11, 10, ... 1