Help me real quick with the DOS "move" command [update: SOLVED]

Killbat

Diamond Member
Jan 9, 2000
6,641
1
0
How do I instruct the console command "move" in Windows2000 to move every file in a folder except certain ones I specify? I want to use a wildcard *.*, but there will be two files I don't want to move. Can I do this?


[update]
Thanks for all the suggestions, but I got it working! A simple "move" batch file does the trick, as I can prevent certain files from being touched by setting their 'read-only' and 'system' attributes. Beauty!
 

Killbat

Diamond Member
Jan 9, 2000
6,641
1
0
I'm thinking I might do that, but then the icon for that file will go back to the default position. (this is on the desktop)
 

Killbat

Diamond Member
Jan 9, 2000
6,641
1
0
I want to make a batch file that moves ("dumps") all the files on my desktop except one or two shortcuts I keep there.
 

ndee

Lifer
Jul 18, 2000
12,680
1
0
copy C:\windows\desktop\*.* C:\thisismyextremlycoolbackupfolder
del C:\windows\desktop\*.*
copy C:\thisismyextremlycoolbackupfolder\shortcut1.lnk c:\windows\desktop
copy C:\thisismyextremlycoolbackupfolder\shortcut2.lnk c:\windows\desktop



It's maybe not the most efficent way but it might work...
 

Killbat

Diamond Member
Jan 9, 2000
6,641
1
0
No, that would technically work, but those link icons would reappear in the wrong places.
 

ndee

Lifer
Jul 18, 2000
12,680
1
0
ok, I don't know what you mean with "but those link icons would reappear in the wrong places. ".....
 

shathal

Golden Member
May 4, 2001
1,080
0
0

Then, you may have to take the long route & specify every subdir. DOS doesn't really have an "except" statement - esp. not the "DOS" you've got in W2K, AFAIK.

If you were using DOS 6.22 I could point you at the "add-on" by some genius chap called "4DOS" which made DOS a lot more bearable & introduced such things as an "EXCEPT" statement.

Sorry - DOS isn't the most intelligent of things.

You could, of course, just re-name the directories you want to move so that they start with the same letter (for instance) and that your two dirs that aren't to be touched start with another letter.

I.e.:
To-be-moved dirs:
- DeZone
- DeBase
- DeArea

Un-touchable dirs:
- QuBert
- WasteBert

Simply specify to move all directories recursively that begin wite de*. :)

Hope this helps somewhat. :D

Otherwise, do the "dirty work" and specify in your batch-file each directory you want to move. It's a long-winded approach, but might work just as well :).
 

shathal

Golden Member
May 4, 2001
1,080
0
0
Oh right - THAT's what he's talking about.

Hmmm ... simplest solution for THAT, I think would be the MACRO Recorder, from Windows 3.X - it should still work.

I think that'd be the easiest thing to do :D.
 

Killbat

Diamond Member
Jan 9, 2000
6,641
1
0
I cannot specify each item to be moved. It'll be different data every time. Hmmm. :(
 

Jasonh100

Senior member
Apr 21, 2001
200
0
0
just to get you thinking on other possibilities.....

Put a copy of the .lnk files that you want on your desktop in the backup location so that it will prompt you to overwrite them. Unfortunately you can't automatically dismiss a overwrite prompt with a no. You can only use the /y switch to automatically say yes. Maybe this is not the case with copy though
 

Jasonh100

Senior member
Apr 21, 2001
200
0
0
What if you added some extra text into the stuff you want to keep that looks like decoration but the batch file uses it to know what not to delete.

EX: < Internet Explorer >

I still don't know how you would move all but those. To use this method, you'd unfortunately, probably have to do that to all the icons you don't want and remove them by doing this...
move *>.* c:\backup\
 

Jasonh100

Senior member
Apr 21, 2001
200
0
0
What is the command so that you can save the output of something to a text file.... I wonder because xcopy looks like it has a ton of stuff but I can't see all the command line switches. Here is what I'm thinking though: You could use Attrib to take the archive attribute off of the stuff you want and then find a command that only affects archival files.
 

Killbat

Diamond Member
Jan 9, 2000
6,641
1
0
xcopy has an EXCLUDE command, but that doesn't help me to remove all but the one file
 

Jasonh100

Senior member
Apr 21, 2001
200
0
0
attrib fileIwant1.lnk -a
attrib fileIwant2.lnk -a
xcopy *.* c:\backup\ /A

This is your answer, I think......
 

Killbat

Diamond Member
Jan 9, 2000
6,641
1
0
But I want to MOVE the files from the desktop.

[edit] More: if I so much as hide/unhide that link, the icon is misplaced. :( Damn.
 

Jasonh100

Senior member
Apr 21, 2001
200
0
0
I still want to know how to save the output of a command to a text file if anyone knows.

That stinks, because that doesn't clear off your desktop. It does copy what you want over though.
 

Jasonh100

Senior member
Apr 21, 2001
200
0
0
how about this........I'll make a program that does it for you...

Let me know if you are interested. It'll take me <10 min
 

Killbat

Diamond Member
Jan 9, 2000
6,641
1
0
Thanks, but I could've done that already myself. I'd much rather just have a batch file. *sigh* :(
 

Jasonh100

Senior member
Apr 21, 2001
200
0
0
I could do it in QBasic 4.5 and compile it so it looks sort of like a batch file. The only way I can think of it do it though would be what I said with the archival and xcopy thing but find the command that saves the output to a text file and then you can use the program to delete all the files that are in the text file. You can interface with the command line with qbasic using shell, so I could do it all from qbasic.
 

Killbat

Diamond Member
Jan 9, 2000
6,641
1
0
Or I could move the files with my MIND. :p
If I hafta to write code to do it, then just forget it.
 

ndee

Lifer
Jul 18, 2000
12,680
1
0
what about this:
you write the contents of a directory to a file, dir >> test.txt and then...... I don't know, but maybe it helps